2

Suppose I have something like this, with branches foo and bar.

* e4417814 (HEAD -> master) A
* 91a3e3d2 B
| * afde3756 (foo) C
| * 6013afc7 D
| * eb9e3403 (bar) E
| * e098075d F
| * 577c0471 G
|/  
* f15d83fc H
* 5e06f896 I

If I do this:

git checkout foo
git rebase master

It will rebase foo onto master but leave bar behind. Something like this:

* 92eba834 (HEAD -> foo) C
* 938eb379 D
* be8377ab E
* 2bbe45b4 F
* 90aa0125 G
* e4417814 (master) A
* 91a3e3d2 B
| * eb9e3403 (bar) E
| * e098075d F
| * 577c0471 G
|/  
* f15d83fc H
* 5e06f896 I

I have to do something annoying like this to fix it.

git branch -f bar be8377ab

Is there any way to tell git to update any other branch labels too when it rebases?

phd
  • 82,685
  • 13
  • 120
  • 165
Timmmm
  • 88,195
  • 71
  • 364
  • 509
  • 1
    Sadly, no, there's no built in mechanism to do this. :-( I've often wished for this too, but there are some issues, the biggest one being that commits may not re-apply cleanly and you need to fix conflicts. – John Szakmeister Jul 10 '19 at 09:39
  • @phd: Not the same. That is two independent branches. This is one branch on top of another. – Timmmm Jul 10 '19 at 16:41
  • The situation is almost the same (I'm sure it's a dup) and the answer is the same: no way. – phd Jul 10 '19 at 16:43
  • The situation is close but not the same. The answers in that question (e.g. [this one](https://stackoverflow.com/a/8508802/265521)) will not work in this situation. Please don't mark questions as duplicates if you aren't sure. It's really annoying. – Timmmm Jul 10 '19 at 16:54
  • Possible duplicate of [How do I rebase a chain of local git branches?](https://stackoverflow.com/questions/20834648/how-do-i-rebase-a-chain-of-local-git-branches) – Daniel McIntosh Dec 03 '19 at 21:50
  • Does this answer your question? [How do I rebase a chain of local git branches?](https://stackoverflow.com/questions/20834648/how-do-i-rebase-a-chain-of-local-git-branches) – Daniel McIntosh Dec 03 '19 at 21:51

0 Answers0