Skip to contentSkip to conversation

Moving a branch to a different node

DISCUSSION Mike Solomon 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hey git users,
I am working on a project where I proceeded by the following steps:

starting from master...
1) create branch foo
2) work in foo, make some commits, then a patch named Foo
3) create a branch bar while in foo
4) work in bar, make some commits, then a patch named Bar

git show-branch gives me

! [master] Hello
* [foo] Foo
! [bar] Bar

I would like to make bar split off of master instead of foo so that I can format a patch that can be applied to master (Bar) without having to first apply Foo. Is there a way to do that?

Thank you!
~Mike

#1 lore raw

I believe what you want is:

git rebase --onto master foo bar

Quoted 28 lines · Mike Solomon

Hey git users,
   I am working on a project where I proceeded by the following steps:

starting from master...
1) create branch foo
2) work in foo, make some commits, then a patch named Foo
3) create a branch bar while in foo
4) work in bar, make some commits, then a patch named Bar

git show-branch gives me

! [master] Hello
 * [foo] Foo
 ! [bar] Bar

I would like to make bar split off of master instead of foo so that I can format a patch that can be applied to master (Bar) without having to first apply Foo.  Is there a way to do that?

Thank you!
~Mike

--
To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Mike Solomon
Quoted 11 lines · Mike Solomon

Hey git users,
I am working on a project where I proceeded by the following steps:

starting from master...
1) create branch foo
2) work in foo, make some commits, then a patch named Foo
3) create a branch bar while in foo
4) work in bar, make some commits, then a patch named Bar

git show-branch gives me

Quoted 7 lines

! [master] Hello
* [foo] Foo
! [bar] Bar

I would like to make bar split off of master instead of foo so that I can format a patch that can be applied to master (Bar) without having to first apply Foo. Is there a way to do that?

IIUC you want to rebase the commits in bar that are not in foo onto master.

$ git rebase --onto master foo bar

Andreas.

Signature · 3 lines
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."