Git rebase interactive drop vs deleting the commit line

21,842

Solution 1

There is no difference by default; it's just another way to say the same thing.

But, if you set rebase.missingCommitsCheck to warn or error, then removing a line will trigger a warning (useful for detecting a messed-up cut-and-paste).

Then setting the line to drop explicitly tells Git that you want to drop that commit, and no warning is shown for it.

Solution 2

There is in fact another small difference:

You can explicitly "drop" all commits. The effect will be the same as a reset.

However if you just delete all lines, then git will tell you "Nothing to do".

Usually you would not use rebase anyway in that case. I learned the difference only when I tried to explain removing a commit with rebase to a co-worker using a dummy commit.

Solution 3

Marking a commit as drop is the same as deleting the line.

The commit will be dropped/ignored.

See when you scroll down:

If you remove a line here THAT COMMIT WILL BE LOST.

The drop command was added in 2.6.0-rc1:

"git rebase -i" learned "drop commit-object-name subject" command as another way to skip replaying of a commit.

Share:
21,842
Wazery
Author by

Wazery

Software Engineer | ex-GSoCer《2012》| GSoC 2013 Mentor | KDE Developer | Ubuntu Official Member | Rails Contributor | CS Graduate | Fan of {OpenSource, SciFi, Tennis, Electro Music}. Areas of familiarity: Web Programming (Ruby on Rails, CSS, HTML, JavaScript) C/C++ Qt Linkedin: wazery Github: wazery Twitter: wazery_ http://stackexchange.com/users/flair/98894.png

Updated on July 05, 2022

Comments

  • Wazery
    Wazery about 2 years

    What is the difference from drop in the Git interactive rebase and just deleting the line of the commit?