Is there any way to recover uncommitted changes to the working directory from a git reset --hard HEAD
?
I ran into same issue and I was almost going insane....initially i committed the project and merged..
later when i try running git push --set-upstream origin master
i was getting this error
fatal: refusing to merge unrelated histories
so i ran git reset --hard HEAD
and it deleted a 3 weeks project but these few commands below save the day:
git reset HEAD@{1} //this command unstage changes after reset
git fsck --lost-found //I got the dangling commit fc3b6bee2bca5d8a7e16b6adaca6a76e620eca4b
git show fc3b6bee2bca5d8a7e16b6adaca6a76e620eca4b>
git rebase fc3b6bee2bca5d8a7e16b6adaca6a76e620eca4b
hope this helps