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

[PATCH] Make rebase save ORIG_HEAD if using current branch

From
Brian Gernhardt <benji@silverinsanity.com>
Date
May 6, 2008, 05:19 UTC
Message-ID
<20080506051920.GA9165@Hermes.local>

This makes rebase act a little more like merge when working on the current branch. This is particularly useful for `git pull --rebase`

Signed-off-by: Brian Gernhardt <benji@silverinsanity.com>
---
 I was trying to figure out why reviewing the new changes in git was so
 hard using my `git log ORIG_HEAD..` alias.  Turns out my ORIG_HEAD
 hadn't been updated since Feburary, which is when I set
 branch.master.rebase to true.
 I think ORIG_HEAD should be set every time a pull changes HEAD, whether
 by a merge or rebase.  Making rebase act like merge seemed more elegant
 than having git-pull set ORIG_HEAD iff using rebase.
 git-rebase.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index 9b13b83..8d54d9f 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -342,6 +342,7 @@ case "$#" in
 		branch_name=HEAD ;# detached
 	fi
 	branch=$(git rev-parse --verify "${branch_name}^0") || exit
+	echo "$branch" > "$GIT_DIR/ORIG_HEAD"
 	;;
 esac
 orig_head=$branch
-- 
1.5.5.1.242.g558e8
Next: Johannes Sixt
Message 1 of 5 in “Make rebase save ORIG_HEAD if using current branch”
  1. Make rebase save ORIG_HEAD if using current branchBrian Gernhardt, May 6, 2008
  2. Johannes SixtMay 6, 2008
  3. Brian GernhardtMay 6, 2008
  4. Johannes SixtMay 7, 2008
  5. Junio C HamanoMay 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.