提交 68a163c9 编写于 作者: J Johannes Schindelin 提交者: Junio C Hamano

rebase -i: provide reasonable reflog for the rebased branch

If your rebase succeeded, the HEAD's reflog will still show the whole
mess, but "<branchname>@{1}" now shows the state _before_ the rebase,
so that you can reset (or compare) the original and the rebased
revisions more easily.
Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 c54b7817
......@@ -151,8 +151,14 @@ do_next () {
esac
test -s "$TODO" && return
HEAD=$(git rev-parse HEAD)
HEADNAME=$(cat "$DOTEST"/head-name)
comment_for_reflog finish &&
HEADNAME=$(cat "$DOTEST"/head-name) &&
OLDHEAD=$(cat "$DOTEST"/head) &&
SHORTONTO=$(git rev-parse --short $(cat "$DOTEST"/onto)) &&
NEWHEAD=$(git rev-parse HEAD) &&
message="$GIT_REFLOG_ACTION: $HEADNAME onto $SHORTONTO)" &&
git update-ref -m "$message" $HEADNAME $NEWHEAD $OLDHEAD &&
git symbolic-ref HEAD $HEADNAME &&
rm -rf "$DOTEST" &&
warn "Successfully rebased and updated $HEADNAME."
......
......@@ -99,6 +99,10 @@ test_expect_success 'rebase on top of a non-conflicting commit' '
test $(git rev-parse I) = $(git rev-parse HEAD~2)
'
test_expect_success 'reflog for the branch shows state before rebase' '
test $(git rev-parse branch1@{1}) = $(git rev-parse original-branch1)
'
test_expect_success 'exchange two commits' '
FAKE_LINES="2 1" git rebase -i HEAD~2 &&
test H = $(git cat-file commit HEAD^ | tail -n 1) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册