Comment by sigjuice
7 years ago
Why not simply push a second commit that reverts the broken commit? This will avoid rewriting history and messing up the rest of your team.
7 years ago
Why not simply push a second commit that reverts the broken commit? This will avoid rewriting history and messing up the rest of your team.
Because that will pollute the history and diminish its value as a record of what happened in the code base. For instance, blame will no longer tell you when a line was changed, but rather point to the revert commit. Bisect breaks if it divides through the reverted commits.
Of course, rewriting history is only feasible immediately after the mistaken commits, before anyone builds on top of them. If they've lingered, reverting is the right way.
And again, if this is a repeating problem, fix it upstream (no pushing to master, only PRs).