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

Re: BUG: git rebase -i -p silently looses commits

From
Ddemerphq <demerphq@gmail.com>
Date
Nov 2, 2009, 16:33 UTC
Message-ID
<9b18b3110911020833y56be8fbdoaf10b6e6259f57c8@mail.gmail.com>
In-Reply-To
<85647ef50911020818p61d0c975kd5655fa58993e07b@mail.gmail.com>
2009/11/2 Constantine Plotnikov <constantine.plotnikov@gmail.com>:
Show 41 quoted lines
> I have encountered what looks like critical bugs in the git rebase -i
> -p (it can be reproduced on mingw and cygwin, I have not tried other
> platforms).
>
> Let's create a git repository with
>
> git init
> # the next line is for mingw
> git config core.autocrlf input
> echo a >a.txt
> echo b >b.txt
> git add a.txt b.txt
> git commit -m "init commit"
> echo aa >a.txt
> git add a.txt
> git commit -m "aa commit"
> echo bb >b.txt
> git add b.txt
> git commit -m "bb commit"
> echo aaa >a.txt
> git add a.txt
> git commit -m "aaa commit"
>
> Now let's use the following rebase command:
>
> git rebase -i -p HEAD~3
>
> When the editor will appear, just move the commit "bb commit" to the
> end of the list. The rebase process will complete successfully, but
> commit "aaa commit" will be missing from the history and working tree
> will not be affected by that commit.
>
> Other bug is that if we move "bb commit" to the top of the list in the
> editor, the rebase process will apply "bb commit", but instead of
> applying "aa commit" and than "aaa commit", the rebase process fails
> with a merge conflict.
>
> This can be reproduced with git 1.6.5.1 (msys) and 1.6.1.2 (cygwin). I
> consider these to be a critical bugs that make "-p" option extremely
> dangerous for interactive rebase. It might even make sense to disable
> it for interactive rebase until the bug is fixed.
Doesnt -p ONLY work for interactive rebase?
       -p, --preserve-merges
           Instead of ignoring merges, try to recreate them. This
option only works in interactive mode.
Yves
-- 
perl -Mre=debug -e "/just|another|perl|hacker/"
Previous: Constantine PlotnikovNext: Constantine Plotnikov
Message 2 of 9 in “BUG: git rebase -i -p silently looses commits”
  1. Constantine PlotnikovNov 2, 2009
  2. demerphqNov 2, 2009
  3. Constantine PlotnikovNov 2, 2009
  4. Sverre RabbelierNov 2, 2009
  5. Johannes SchindelinNov 2, 2009
  6. Greg PriceNov 4, 2009
  7. Johannes SchindelinNov 11, 2009
  8. Greg PriceNov 12, 2009
  9. Johannes SchindelinNov 13, 2009

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.