Now that the "checkout" invoked internally from "rebase" knows to honor GIT_REFLOG_ACTION, we can start to use it to write a better reflog message when "rebase anotherbranch", "rebase --onto branch", etc. internally checks out the new fork point. We will write: rebase: checkout master instead of the old rebase Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx> Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- git-rebase--am.sh | 2 ++ git-rebase.sh | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/git-rebase--am.sh b/git-rebase--am.sh index 34e3102..d4bade8 100644 --- a/git-rebase--am.sh +++ b/git-rebase--am.sh @@ -40,9 +40,11 @@ else rm -f "$GIT_DIR/rebased-patches" case "$head_name" in refs/heads/*) + GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $head_name" git checkout -q "$head_name" ;; *) + GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $orig_head" git checkout -q "$orig_head" ;; esac diff --git a/git-rebase.sh b/git-rebase.sh index d0c11a9..b43600d 100755 --- a/git-rebase.sh +++ b/git-rebase.sh @@ -543,7 +543,11 @@ then if test -z "$force_rebase" then # Lazily switch to the target branch if needed... - test -z "$switch_to" || git checkout "$switch_to" -- + if test -n "$switch_to" + then + GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $switch_to" + git checkout "$switch_to" -- + fi say "$(eval_gettext "Current branch \$branch_name is up to date.")" exit 0 else @@ -568,6 +572,8 @@ test "$type" = interactive && run_specific_rebase # Detach HEAD and reset the tree say "$(gettext "First, rewinding head to replay your work on top of it...")" + +GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name" git checkout -q "$onto^0" || die "could not detach HEAD" git update-ref ORIG_HEAD $orig_head -- 1.8.3.1.456.gb7f4cb6 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html