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

[BUG?] rebase -i -p leaves index changed

From
Thomas Rast <trast@student.ethz.ch>
Date
Aug 12, 2008, 09:16 UTC
Message-ID
<200808121116.41535.trast@student.ethz.ch>
Hi,

'rebase -i -p' appears to be a bit confused about what it is doing. Try a history like this:

  O -- A -- M -- B
   \       /
    \- C -/
built by:
  git init
  touch foo
  git add foo
  git ci -m initial
  git tag root
  git co -b side
  echo blah > other
  git add other
  git ci -m other
  git co master
  echo a >> foo
  git add foo
  git ci -m a
  git add foo
  git merge side
  echo b >> foo
  git add foo
  git ci -m 'b: depends on side'
First try this:
  GIT_EDITOR=true git rebase -i -p root
  git diff --cached
resulting in
  diff --git a/foo b/foo
  index 422c2b7..e69de29 100644
  --- a/foo
  +++ b/foo
  @@ -1,2 +0,0 @@
  -a
  -b
  diff --git a/other b/other
  deleted file mode 100644
  index 907b308..0000000
  --- a/other
  +++ /dev/null
  @@ -1 +0,0 @@
  -blah
Second, 'edit' is also a bit suspicious:
  git reset --hard
  GIT_EDITOR='perl -i -pe "s/pick 096/edit 096/"' git rebase -i -p root

Despite claiming "Stopped at 096[...] a", a quick 'git show' tells us that it is actually stuck at 'initial'. (At least 'git rebase --continue' then ends up with the same result as the first test.)

Granted, I'm not entirely sure what it _should_ do. In my use case (relating to the filter-branch topic), C was a commit from elsewhere that B depended on. So I kind of hoped 'rebase -i -p' would let me edit A, then rebuild M and B on top, while leaving C alone.

- Thomas
-- 
Thomas Rast
trast@student.ethz.ch
Next: Thomas Rast
Message 1 of 10 in “[BUG?] rebase -i -p leaves index changed”
  1. Thomas RastAug 12, 2008
  2. 1/2 rebase -i -p: handle index and workdir correctlyThomas Rast, Aug 13, 2008
  3. 2/2 rebase -i -p: fix parent rewritingThomas Rast, Aug 13, 2008
  4. Thomas RastAug 13, 2008
  5. 1/2 rebase -i -p: handle index and workdir correctlyThomas Rast, Aug 13, 2008
  6. 2/2 rebase -i -p: fix parent rewritingThomas Rast, Aug 13, 2008
  7. Stephan BeyerAug 13, 2008
  8. 1/2 rebase -i -p: handle index and workdir correctlyThomas Rast, Aug 13, 2008
  9. 2/2 rebase -i -p: fix parent rewritingThomas Rast, Aug 13, 2008
  10. Stephan BeyerAug 13, 2008

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.