How to undo the last local commit in Git?
Recently I was making some changes to a local git repository and I committed some changes and files that I should not have committed.
I did not run
git push so the changes were only committed to my local Git repository.
So I decided to share how I reverted the last commit here with the community in case someone gets in the same situation.
So rather than wiping out your whole local repo and cloning a fresh copy, you could do the following:
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×