Git revert, git reset, and git checkout

A nice summary on the differences between git revert, git reset, and git checkout by https://git-scm.com/docs/git-revert:

git revert is used to record some new commits to reverse the effect of some earlier commits (often only a faulty one). If you want to throw away all uncommitted changes in your working directory, you should see git-reset[1], particularly the –hard option. If you want to extract specific files as they were in another commit, you should see git-checkout[1], specifically the git checkout — syntax. Take care with these alternatives as both will discard uncommitted changes in your working directory.

And an article by Atlassian: https://www.atlassian.com/git/tutorials/resetting-checking-out-and-reverting

Advertisements
Git revert, git reset, and git checkout

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s