Search code examples
gitbranchdvcsrebasegit-rebase

rebasing branch, which has own branches


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?


Solution

  • 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