Search code examples
git-rebase

Git Rebasing with multiple committers on same branch


We ran into a problem where, if you rebase your branch on top of master and then push, the other guy who was working on your branch pulls and gets all kind of merge conflicts, because the rebase has rewritten the history and the commits are not the same as they were on the branch. Is there any way around this, assuming that the other guy has some commits he wants to push to the branch?


Solution

  • You can check the "Recovering From Upstream Rebase" section of the git rebase man page.
    Basically, your colleague will have to do (considering here 'subsystem' as having been rebased):

    git rebase subsystem
    

    (if his changes are on a separate branch)

    or:

     git rebase --onto subsystem subsystem@{1}