Reading about git workflows, I was wondering about the appropriateness of history rewriting. My workflow, and I imagine that of many others, is this:
As I get feedback, it seems like I would want to do some rebasing and squashing, as often the feedback are minor things like rewording comments or things that should have been different in the first place, and don't deserve their own commit.
But from the documentation, it seems like I am not supposed to change history on rep2, and indeed things like --ammend don't work in this scenario. Is my workflow wrong, or am I misunderstanding those warnings about changing history?
The rule about rebase
is this: You should only rebase your local branches once the branch is a public branch which anyone can grab it, you should not rebase on this branch again, or you can damage all the other repo who have already cloned this branch.
If for some reason you do decide to rebase
public (pushed branch) you have to make sure all the users who pulled this branch are aware of your rebase
.
You can check it using git pre-rebase
hook to decline the rebase or to display a warning or error in that case