First, got "your branch is ahead of origin/master by 3 commits" then my app has reverted to an earlier time with earlier changes.
How can I get what I spent the last 11 hours doing back?
The first step to recovering your lost commits is to recover the list of all your previous commits and actions done on the repository. Note: Keep in mind that the given commit hashes and signatures may differ from that of your local repository. Replace all relevant information with the info corresponding to your log.
If you are using any JetBrains software, right click and go to "Local History > Show History". From here, you should see a list of local edit history separate from the Git history. You can choose any version to revert to.
To restore it, we can simply run a hard reset to the commit we want to take. In my case, I will need to run git reset --hard f52ee7b . Hooray! After doing all of these, you finally can restore your deleted commit.
git reflog
is your friend. Find the commit that you want to be on in that list and you can reset to it (for example:git reset --hard e870e41
).
(If you didn't commit your changes... you might be in trouble - commit early, and commit often!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With