Git rebase interactive drop vs deleting the commit line

假装没事ソ 提交于 2019-12-02 23:19:29

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

But, if you enable rebase.missingCommitsCheck, then removing a line will trigger a warning (useful to detect if you messed-up a cut-and-paste), while using drop tells Git explicitly that you want to drop the line, and Git won't give any warning.

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.

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!