Commit dropped when swapping commits with rebase -i -p
- Date: Wed, 30 Aug 2017 12:11:14 +0200
- From: Sebastian Schuberth <sschuberth@xxxxxxxxx>
- Subject: Commit dropped when swapping commits with rebase -i -p
I believe stumbled upon a nasty bug in Git: It looks like a commits gets dropped during interactive rebase when asking to preserve merges. Steps:
$ git clone -b git-bug --single-branch https://github.com/heremaps/scancode-toolkit.git
$ git rebase -i -p HEAD~2
# In the editor, swap the order of the two (non-merge) commits.
$ git diff origin/git-bug
The last command will show a non-empty diff which looks as if the "Do not shadow the os package with a variable name" commit has been dropped, and indeed "git log" confirms this. The commit should not get dropped, and it does not if just using "git rebase -i -p HEAD~2" (without "-p").
I'm observing this with Git 2.14.1 on Linux.