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

git rebase -i -p broken?

From
AKAvi Kivity <avi@redhat.com>
Date
Oct 5, 2008, 15:30 UTC
Message-ID
<48E8DD7E.9040706@redhat.com>
Consider this scenario:
- commit some patch (named 'a')
- merge a random branch
- commit a fix to patch a
- since I haven't pushed yet, I want to squash a and a-fix together, to 
prevent bisect problems
- fire up 'git rebase -i -p a^'
Now the problems begin:
- the todo list shows up the branch's commits as well as my current 
branch.  But I don't want to commit the branch's commits in my own 
branch.  Replaying the merge should be enough.  Looks like a missing 
--first-parent somewhere.
- removing the spurious commit from the todo, and moving a-fix after a 
and marking it as a squash action, I get
   Refusing to squash a merge: 51ca22d7afb7433332ae41d0c2e3bab598048c21
  even though that's not a merge
- using git commit --amend instead of squash confuses git in some other way

Attached is a script that generates a test case. With some $EDITOR hacks it can even be convinced to be an automated test case.

All this using 1.6.0.2.
-- 
error compiling committee.c: too many arguments to function



!#/bin/sh -e

git --version
mkdir repo
cd repo
git init
touch a
touch 0
git add 0
git commit -m 'zeroth commit'
git add a
git commit -m 'first commit'
git checkout -b branch
touch b
git add b
git commit -m 'second commit (branch)'
git checkout master
touch c
git add c
git commit -m 'third commit'
git merge branch
touch d
git add d
git commit -m 'fifth commit'
git rebase -i -p HEAD~4
Next: Stephen Haberman
Message 1 of 8 in “git rebase -i -p broken?”
  1. Avi KivityOct 5, 2008
  2. rebase--interactive: if preserving merges, use first-parent to limit what is shown.Stephen Haberman, Oct 6, 2008
  3. Stephen HabermanOct 7, 2008
  4. Stephen HabermanOct 7, 2008
  5. Shawn O. PearceOct 7, 2008
  6. Avi KivityOct 7, 2008
  7. Stephan BeyerOct 7, 2008
  8. Avi KivityOct 7, 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.