/ 1 min read
Git revert reset & restore, whats the difference ?
Git revert, reset & restore, what’s the difference ?
git revert is for undoing the changes of a commit, it create a new commit that does the opposite of the commit you want to undo.
git reset is for going back to a specific commit, it doesn’t add a new commit, just moves the HEAD to a previous commit
And, git restore is for undoing the current unstaged changes.
So remember, revert creates an undo commit, reset goes back to a previous commit and restore for discarding file changes.
Hope this helps, see ya