{"thread":{"id":"8717","subject":"[PATCH 2/3] rebase -i: provide reasonable reflog for the rebased branch","startedAt":"2007-06-25T17:58:28Z","lastAt":"2007-06-25T17:58:28Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"45782","messageId":"Pine.LNX.4.64.0706251857410.4059@racer.site","threadId":"8717","inReplyTo":null,"subject":"[PATCH 2/3] rebase -i: provide reasonable reflog for the rebased branch","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-06-25T17:58:28Z","receivedAt":"2007-06-25T17:58:28Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nIf your rebase succeeded, the HEAD's reflog will still show the whole\nmess, but \"<branchname>@{1}\" now shows the state _before_ the rebase,\nso that you can reset (or compare) the original and the rebased\nrevisions more easily.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tJohannes, how about this? ;-)\n\n git-rebase--interactive.sh    |   10 ++++++++--\n t/t3404-rebase-interactive.sh |    4 ++++\n 2 files changed, 12 insertions(+), 2 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex b95fe86..fb93e13 100755\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -151,8 +151,14 @@ do_next () {\n \tesac\n \ttest -s \"$TODO\" && return\n \n-\tHEAD=$(git rev-parse HEAD)\n-\tHEADNAME=$(cat \"$DOTEST\"/head-name)\n+\tcomment_for_reflog finish &&\n+\tHEADNAME=$(cat \"$DOTEST\"/head-name) &&\n+\tOLDHEAD=$(cat \"$DOTEST\"/head) &&\n+\tSHORTONTO=$(git rev-parse --short $(cat \"$DOTEST\"/onto)) &&\n+\tNEWHEAD=$(git rev-parse HEAD) &&\n+\tmessage=\"$GIT_REFLOG_ACTION: $HEADNAME onto $SHORTONTO)\" &&\n+\tgit update-ref -m \"$message\" $HEADNAME $NEWHEAD $OLDHEAD &&\n+\tgit symbolic-ref HEAD $HEADNAME &&\n \trm -rf \"$DOTEST\" &&\n \twarn \"Successfully rebased and updated $HEADNAME.\"\n \ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 19a3a8e..9f12bb9 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -99,6 +99,10 @@ test_expect_success 'rebase on top of a non-conflicting commit' '\n \ttest $(git rev-parse I) = $(git rev-parse HEAD~2)\n '\n \n+test_expect_success 'reflog for the branch shows state before rebase' '\n+\ttest $(git rev-parse branch1@{1}) = $(git rev-parse original-branch1)\n+'\n+\n test_expect_success 'exchange two commits' '\n \tFAKE_LINES=\"2 1\" git rebase -i HEAD~2 &&\n \ttest H = $(git cat-file commit HEAD^ | tail -n 1) &&\n-- \n1.5.2.2.3172.ge55a1-dirty\n"}]}