Skip to contentSkip to conversation

Make rebase save ORIG_HEAD if changing current branch

PATCH Superseded Brian Gernhardt 1 participant 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Make rebase save ORIG_HEAD if changing current branch

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

---

If I followed the discussion the last time I sent this in correctly, the two issues were:

- Ugly "echo > ORIG_HEAD" instead of pretty "git update-ref ORIG_HEAD"
- Setting ORIG_HEAD at the wrong place

Let me know if there are any other issues.

 git-rebase.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-rebase.sh +1 -0
index e2d85ee..44db7e6 100755
@@ -434,3 +434,4 @@ do
 done
 
 finish_rb_merge
+git update-ref ORIG_HEAD $orig_head
Signature · 1 line
1.5.6.1.324.gc55f7
#1 lore raw

PATCH v3 1/1 Make rebase save ORIG_HEAD if changing current branch

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

---

Okay, I apparently should stop coding after midnight, even if I think I'm awake enough. This version uses the correct variable. $orig_head looks like the right name, but it stores the symbolic ref. $prev_head stores the actual SHA1, which is what I was looking for.

 git-rebase.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
git-rebase.sh +1 -0
index e2d85ee..44db7e6 100755
@@ -434,3 +434,4 @@ do
 done
 
 finish_rb_merge
+git update-ref ORIG_HEAD $orig_head
Signature · 1 line
1.5.6.2.337.gf6537