I intended to git reset --hard to the last commit I made but I accidentally went back to the commit before that. Is there anyway to undo this.
This was the sequence of events: 1. I pulled from a common repo and made some changes and committed them (SHA1). I made more changes and committed them too(SHA2). Then I made some more changes but never committed them I just wanted to go back to SHA2. Instead I reset to SHA1. Now, all my changes are lost. Can I undo the last reset and get to SHA2?
What I mean is when I did a git log:
"SHA2" - HEAD
Jun 26
some comment -1
"SHA1" - Origin
Jun 25
some comment -2
I reset to SHA1 instead of to SHA2. Can I undo my reset --hard
I'd look at
git reflog
. It keeps track of many of your local changes, and can be used to recover lost commits (assuming clean-up hasn't occured)