How would I “rollback” the last commit in git without deleting any changes?
This is something I’ve done often in hg:
- Commit “Fixed 107.”
- Remembered that I forgot to do something
- hg rollback
- Do something
- Commit “Fixed 107.”
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.
With git you may actually prefer to use the
--amendoption in that case.git commit --amendand edit the notesIf you need to rollback for other reasons take a look at
git revert