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!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
While I agree with the sentiment that this helps understand how git works - and
diff
s 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 revertscommit
s directly, and it even automatically leaves the matching comment. This should very much be the default for reverting changes.That said, on
merge
s, I don't personally like using it, because it can leave a distorted tree. In that case, I much prefer areset
to rewrite history as if themerge
never happened - that's a personal preference, though!