- I committed my changes, and started working on a new feature.
- I realized that I have messed things up
- Needed to revert back to the previous commit.
What I did.
git add .
git commit -m "Screwed Up"
git branch -m experiment
git checkout 62b5 (SHA1 of previous commit)
git checkout -b master
git branch -D experiment
I think there must be a better way to revert to the previous commit.
When I tried, git reset HEAD
, it would still show the uncommitted changes, when I do git status
.
If there's a better way to do it, what is it ? Or should I be using a different workflow to avoid situations like this ?