I’ve pulled code down from my repo which has messed things up. I’d like to revert my entire project to my last local commit. How would I do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will reset everything to your current commit (getting rid of all changes, staged or otherwise:
This will reset everything to the previous commit (also getting rid of all changes, staged or otherwise)
the ^ next to HEAD means one commit before HEAD, HEAD being where you are currently. You can go two commits back by using ^^, or three with ^^^. Additionally you can use a tilde to specify the number of commits: ~3 for three commits back.
Also keep in mind that the –hard option means that these commands will throw away any changes you have that are not stashed.