Custom Search

Tuesday, December 10, 2013

Git How to revert last commit

How to revert last commit
#git log
#git reset --soft HEAD~1 # use --soft if you want to keep your local changes and revert last commit
#git reset --hard HEAD~1 # use --hard if you want to revert your changes and revert last commit
#git log



How to revert last two commit
#git log
#git reset --soft HEAD~2 # use --soft if you want to keep your local changes and revert last commit
#git reset --hard HEAD~2 # use --hard if you want to revert your changes and revert last commit
#git log

How to revert last three commit
#git log
#git reset --soft HEAD~3 # use --soft if you want to keep your local changes and revert last commit
#git reset --hard HEAD~3 # use --hard if you want to revert your changes and revert last commit
#git log

No comments:

Post a Comment