| Merging is a process that I like over rebasing exactly because it conserves the history. With a repository server that supports merge requests and feedback from CI/CD tooling on commits/push you can motivate people to use merges rather cleanly. If you add to that very simple rules like - create branches for every feature - commit often - push often - merge only via merge/pull requests then even people new to Git can handle it just fine. Merge conflicts happen when multiple people work on the same file and try to merge their different status.
Imho, code bases where multiple people work on the same file at the same time have a more fundamental problem than Git. Honestly, I still struggle to see the value
in rebasing. Maybe because I haven't used it extensively. Superficially, to me at least, it does the same as a "git push -f". I am curious to hear why it is supposed to be superior, especially with modern CI tools like Github and the likes. |
> I still struggle to see the value in rebasing. Maybe because I haven't used it extensively. Superficially, to me at least, it does the same as a "git push -f".
Rebasing is completely different from pushing. Rebasing changes your history. You can do whatever you want with your history: rebasing, creating personal branches and moving them around, etc... and no one will know. Only your pushes matter to the rest of the world, or alternatively when others pull from your repository. "git push -f" means you don't want to play along with whatever is in the repository you are pushing into, it is usually bad as it may desynchronize it from everyone else's fork. You absolutely don't need to do a "git push -f" with rebase, in fact you really shouldn't.
And none of your rules prevent rebasing. The commit/push often rule make the need for rebasing less likely, but if a dev did a rebase, no one will notice, it didn't leave his own machine. He mostly did that to make the commit he pushed less awkward.