loading...

re: ELI5: Git Rebase vs. Merge VIEW POST

FULL DISCUSSION
 

Hi! I'm confused. I can create a feature branch, push it, and do rebase (thinking that is my branch) or I have to follow the golden rule in this case too?

 

Private/public, in this regard, is not about who can see the branch but about who is going to work on it.

If only you push to that feature branch, and others are only reading it to review your code, then it's safe to rebase it. Your peers will not lose their work due to your rebase because they don't have any work inside that branch (except from commits it shares with master, of course).

If more developers other than you have pushed to that branch, you can still rebase - but you have to coordinate the rebase with them to make sure you don't lose any of their work. If there aren't that many of them, and if they only pushed to that branch one specific commit that you have personally requested from them (e.g. - you needed something that's out of your expertise), then it's easy. But if many developers are constantly pushing to that branch, coordinating a rebase becomes much harder, much riskier, and with much more damage potential - so it's best to avoid it and just merge.

 
Code of Conduct Report abuse