found 532775 git-core/1:1.6.5.3-1 retitle 532775 rebase -i -p: very easy to mess up history thanks
Hi, Jiří Paleček wrote: > +--------+ +-------+ +-------+ +-------+ +-------+ +-------+ > | master +------+ Xs... +---+ A +---+ Ys... +---+ B +---+ Zs... | > +--------+ +-------+ +-------+ +-------+ +-------+ +-------+ > > (This whole thing is a single branch) > > I wanted to rebase it to master (that is, I did "rebase -i -p master > branch"), and, while doing it, squash commits A and B together. What I > didn't expect, though, is that after rebase, commits Ys disappeared > from a branch. After doing git lost-found, I discovered that the > history after the rebase was something like this: > > +--------+ +-------+ +-------+ +-------+ > | master +------+ Xs... +---+ A+B +---+ Zs... | > +--------+ +-------+ +-------+ +-------+ > \-- > \- +-------+ > \+ Ys... | > +-------+ > > The Ys weren't on any branch. Yes, I can reproduce this: cat >test_editor <<\EOF #!/bin/sh if expr "$1" : ".*/COMMIT_EDITMSG" >/dev/null 2>&1 then echo A+B >"$1" else { read two read three read four read five echo "$two" echo "$four" | sed "s/pick/squash/" echo "$three" echo "$five" } <"$1" >"$1"+ mv "$1"+ "$1" fi EOF chmod +x test_editor git init test_repo cd test_repo echo 1 > 1 && git add 1 && git commit -m 1 git checkout -b topic seq 2 5 | while read n do echo $n > $n git add $n git commit -m $n done GIT_EDITOR=../test_editor git rebase -i -p master test $(git log --oneline | wc -l) = 4 || echo FAILED This fails as written, succeeds if "-p" is removed from the 'git rebase' line. The problem is that 'git rebase -i -p' is not good for anything but transplanting a branch wholesale at the moment. This report would be a wishlist bug for a new feature, if the documentation did not already misleadingly promise so much. Sorry I can’t help much. Hope that makes things a little clearer, anyway. Jonathan -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org