I have a git repo that I hadn't commit in almost a week.
I was working on fixing how to display error messages in my react app.
So i decided to make a new branch by calling git checkout -b fix-error-msg
(note: I did NOT commit to master before creating new branch)
I made some changes in my code, but realised they were incorrect, so I decided I could be clever and go back to my original status by calling
git commit -am 'oops'
followed by
git checkout master
and
followed by git branch -D fix-error-msg
I was hoping it would revert the code to what it was before I created the fix-error-msg
branch.
Nope - it's reverted the code to what it was a week ago since my last commit on master
.
I decided to be clever and paid for it.
Is there any way to revert this mistake?