RockPaperScissors

LizardSpock

Reverting in Git

| Comments

I use to use svn revert to roll back local modification and get back to the state I was in last time I checked out.

to do the same in git I use :

git checkout -- filename

As git does not automatically push to a server the way subversion does you have an opportunity to revert local commits.

git reset --soft HEAD^

Here the ^ means previous. ie go back 1 commit. Using soft the files will still appear modified and we can use the previous command to reset the files as required.

Further reading what “git reset” does in plain english?, Visual Git Reference and Reset Demystified

git checkout source.
git reset source.

Comments