Alex Rivera | Logout

What's the difference between Git Revert, Checkout and Reset?

Asked 2011-12-02T13:37:48.667
401

I am trying to learn how to restore or rollback files and projects to a prior state, and don't understand the difference between git revert, checkout, and reset. Why are there 3 different commands for seemingly the same purpose, and when should someone choose one over the other?

Edit
Report

1 Answer

28
  • git checkout modifies your working tree,
  • git reset modifies which reference the branch you're on points to,
  • git revert adds a commit undoing changes.
answered 2011-12-02T14:20:18.523

Your Answer