I lost my last commit because I accidentally ran “git reset –hard HEAD^”. Note: I didn’t want to put the “^” at the end.
Is there any way to get it back? It was 2 days of work 🙁
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think that this article is what you are looking for. According to the article, your commit is “gone,” but not garbage collected – sort of like the recycle bin in Windows.
You run
git fsck --lost-foundto find the ‘dangling commit’, and look at it withgit reflog, then merge the dangling commit with your current branch,git merge 7c61179.