DEV Community

Discussion on: Git Revert to a Good Commit

Collapse
 
fjones profile image
FJones • Edited

While I agree with the sentiment that this helps understand how git works - and diffs are at the center of that - it doesn't actually represent the intent very well: reverting an incorrect commit. It's a handy shortcut and, with a good commit message, a very powerful one at that, but:

Generally, revert does what it says on the tin: it reverts commits directly, and it even automatically leaves the matching comment. This should very much be the default for reverting changes.

That said, on merges, I don't personally like using it, because it can leave a distorted tree. In that case, I much prefer a reset to rewrite history as if the merge never happened - that's a personal preference, though!