views:

35

answers:

2

I can't make git push origin B. I have situation something like this

 _____________________________________ A
   \              
    \               _____origin/B
     \             /   
      \___________/____________.
                               B\
                                 \______________
                                                C

Git suggests me, to do

git rebase origin/B

Is this dangerous for branch C?

Should I earlier rebase C onto some temporary place?

+2  A: 

Rebase rewrites the history. If you rebase B onto origin/B, you'll then have to rebase C onto B.

mipadi
+2  A: 

Rebasing B won't affect any of the commits in C. The history going back from C will still contain the same commits with the same hashes; it just won't contain the branch head B any more.

The commits that currently shared by B and C will be duplicated (content-wise; the hashes will change) when creating the new history for B.

You will end up with:

 _____________________________________ A
   \              
    \               _____origin/B_____ B
     \             /   
      \___________/____________._______C
Ben James
If you want to avoid the duplicate commits, you could then do `git rebase --onto B <previous-position-of-B> C`. You could also avoid making a mess by merging instead of rebasing.
Jefromi