Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Re-base sub-branch off master

Tags:

git

git-branch

still wrapping my head around GIT...

I created a branch off another branch by mistake. Looks like this:

                    c1...c2
                   /
            b1...b2...b3
           /
a1...a2...a3...a4

Meant to do this:

            b1...b2...b3
           /
a1...a2...a3...a4
           \
            c1...c2

I assume there's some way to fix this but after some time with the docs etc. I'm not seeing it. Thanks!

like image 444
jaskho Avatar asked Jan 07 '13 19:01

jaskho


2 Answers

From the c2 branch:

git rebase --onto a3 b2
like image 60
Stuart Golodetz Avatar answered Nov 03 '22 07:11

Stuart Golodetz


lets say your branches are a,b & c , if you created branch c from b instead of creating it from branch a

this is what i would do to fix it

git rebase --onto a b c
like image 33
wonde Avatar answered Nov 03 '22 09:11

wonde