What is the difference between git reset and git revert, and which one is safer for public history and why?

Last updated 6 July 2026

  • git reset rewrites history by moving the branch pointer back, leaving original commits unreachable. On shared branches this forces others to reconcile diverged history.

  • git revert adds a new commit with the inverse changes, keeping history append-only and safe to push normally.

  • Use reset for local, unpublished cleanup and revert for commits already shared.

  • https://www.deployhq.com/git/faqs/difference-git-reset-revert
  • https://gnext.dev/guides/git-reset-vs-revert/
  • https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting
  • https://schacon.github.io/gitbook/4_undoing_in_git_-_reset,_checkout_and_revert.html
  • https://dev.to/nguonodave/time-traveling-through-your-repo-git-reset-vs-revert-1en4
  • https://medium.com/@vikas.taank_40391/understanding-git-reset-and-git-revert-093408d98313
  • https://git-scm.com/docs/git-reset/2.52.0
All Git interview questions