git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Commit dropped when swapping commits with rebase -i -p

From
Sebastian Schuberth <sschuberth@gmail.com>
Date
Aug 30, 2017, 10:11 UTC
Message-ID
<oo62vr$pvq$1@blaine.gmane.org>
Hi,
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.

Regards, Sebastian

Next: Martin Ågren
Message 1 of 12 in “Commit dropped when swapping commits with rebase -i -p”
  1. Sebastian SchuberthAug 30, 2017
  2. Martin ÅgrenAug 30, 2017
  3. Sebastian SchuberthAug 30, 2017
  4. Jonathan NiederSep 2, 2017
  5. Sebastian SchuberthSep 11, 2017
  6. Junio C HamanoSep 15, 2017
  7. Andreas HeidukSep 16, 2017
  8. Sebastian SchuberthSep 16, 2017
  9. Phillip WoodSep 17, 2017
  10. Johannes SchindelinAug 30, 2017
  11. Sebastian SchuberthAug 30, 2017
  12. Johannes SchindelinSep 1, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.