DEV Community

Discussion on: Avoiding the messy git history

Collapse
 
erikpischel profile image
Erik Pischel

Just for clarification:
When you have already pushed your feature branch to remote, and you rebase to develop then the next push to remote would need force or force-with-lease ??

Collapse
 
vlaja profile image
Vlatko Vlahek • Edited

I would say this depends whether you are working solo on a feature or with another developer, based on the feature complexity.

In the case of multiple people working on a branch --force-with-lease is a safer option, although from my perspective the risk is very small. I have personally never got a "racing condition" in overwriting the branch with --force only.

Even if this happens, it is still possible that the person whose commits got overwritten does git reflog locally and rebases again on the current state of the remote branch persisting both changes.