What is the difference between git reset HEAD~1 and git revert HEAD in terms of history?

Git Hard

Git — Hard

What is the difference between git reset HEAD~1 and git revert HEAD in terms of history?

Key points

  • `git reset` rewrites history by moving the branch pointer.
  • `git revert` creates a new commit that undoes changes.
  • History preservation is a key consideration.
  • Shared branches are particularly sensitive to history changes.
  • Inverse commits are used by `git revert`.

Ready to go further?

Related questions