I'm sorry for bringing up the philosophical debate about merge vs rebase, but I have a practical question, regarding a typical company workflow (not an opensource project workflow, which might be different).
Rebasing, as pointed here, should not be used if you have pushed your changes. This is so, because others may have branched from your branch, and then rewriting history of that branch (via force-pushing) will make it hard for them.
So the proper way to use rebasing is by committing only locally. But at least in my brief experience that's not desirable:
- what if your computer gets stolen?
- what if you lose data due to a disk failure?
- what if you have to work from two locations (like this person)
Keeping a feature branch local is something counter-intuitive for me. Not only due to the above points, but also due to the following use-case: you are working on a feature, but either get dragged to something more urgent, or go on holiday, or fall sick. A colleague has to complete it. Then you rebase and push (unless you are sick, in which case it stays local and nobody can complete it), and the other person completes it.
During that period there are changes in master. But the other person is already based on a remote branch, so he should either use merge, or rebase and force-push (which, again, might screw things if other people have based their branches on that one meanwhile).
These may sound like edge cases, but they aren't. At least one of these conditions (work from home, falling sick, going on holiday, finishing someone else's work, etc.) happens rather often.
So, is using "rebase" a good way to go in these usecases, or merging (with the additional "merge commits") is the safer and more straightforward option?