0

Suppose I'm in a git rebase workflow and I have a feature branch with some new commits (rebased on top of master) and another developer joins me to work on that branch - so he also adds some commits.

Now we need to integrate some changes from master into our feature branch. Had I been the only developer working on that branch I would have just rebased my feature branch on top of the updated master and then force pushed the new history for the feature branch to the remote.

Anyway there's another developer now and force pushing a different history is very bad.

How do we solve this issue? Merging from the master branch doesn't sound too different from not using a rebase workflow at all.

How do multiple people collaborate on a rebase workflow feature branch when/if they need to integrate changes from the master branch?

Dean
  • 6,610
  • 6
  • 40
  • 90
  • We usually just let the whole team know a rebase and force push is going to happen, once everyone is ready (including `stash -u`) the branch is changed and everyone rebases their changes --onto the new one. – choroba Jan 04 '23 at 09:25
  • You can do `git push --force-with-lease` to prevent overwriting the changes your colleague pushed before you. This will prevent some accidents, but I think that you will need some communication and coordination anyway. – Krzysiek Karbowiak Jan 04 '23 at 09:38

0 Answers0