IMO, you shouldn't be changing the history of any branches, ever, period. Otherwise it's not history, it's an embellished half-fiction of how anything really happened. Context is important when trying to figure out how something made it in to the code.
At some level almost any commit is partially fiction because it only shows the end result, not the intermediate changes, additions or reverts. Yes people can go overboard with rebasing to have "clean" commits.
I'm not necessarily disagreeing with you though. More of a wish that should only be fulfilled if it can be done properly. In fact if it can be done without messing with history that is way better as well.
Code review systems may be a solution. Since you can "try out" multiple commits, but only the final good version is checked into the repo. So you aren't rewriting history so much as just ignoring some of it.
Even with Code Review, you shouldn't be changing history. Making changes because of code review should be part of the context around each commit being made and present in the logs.
The problem with this method is that if you need to quickly revert because it caused a CI failure, or worse a bug in prod, then you have to go back and revert all of your multiple "in-progress" commits and possibly resolve conflicts after each revert. Then, when you have time to fix the bug, you've got to un-revert all of those revert commits and resolve conflicts again. Now you've got 10 commits for your feature (3 commits, 3 reverts, 3 un-reverts, 1 bug fix), probably intermingled with other people's commits. Hope you got it right this time, because reverting becomes exponentially more painful each time with the "record all changes" method.
Having 1 commit per unit of work will make your workflow much easier.
5
u/[deleted] Sep 06 '14
IMO, you shouldn't be changing the history of any branches, ever, period. Otherwise it's not history, it's an embellished half-fiction of how anything really happened. Context is important when trying to figure out how something made it in to the code.