is it possible to recover commit after deleting corrupted packed-refs and hard reset? Let me explain my scenario in as much detail as possible.
Week 1: I have worked on particular code. After completing the code, I have done below git commands,
- git add .
- git commit -m "commit_text" --no-verify
- git push origin --no-verify (I am not 100% sure but my git bash showing this in last commands which I am checking through up-arrow and I have not find my commit or push on github)
Week 2 (yesterday): My system crashed while working on other code section. And after system restart I started getting error in my local branch in VSC and git bash Error: unterminated line in .git/packed-refs
As Usual I googled and performed below steps and git commands:
- deleted packed-refs(shift-delete - cannot recover)
- git gc --auto
- git init
- git reset --hard
- git init (again)
- git remote add remote_address
- git pull dev(dev branch is where all developers merge their code)
- git fetch (in VSC terminal as it was not connecting to remote branch)
After these steps everything started working fine. But I never checked the week 1 changes that if it is present or not.
Now today I pushed my code(I have pushed using git push -f --no-verify as some issue was there while using git push --no-verify, which i dont remember)Now in evening I am not able to find my week-1 code changes. I have tried below git commands to recover as no commit or push is present on GITHUB, but of no use till now.
- git reflog show (but only showed today's commits)
- git fsck --lost-found (created lost-found directory but didnt found my changes, although very old changes are present :(
- checked dangling commits (no luck)
- git log --all -g --diff-filter=D --stat (nothing happened - used this link's suggestion)
Please if any one can suggest any thing else to recover my commits and changes. I have commit texts but no commit-id or SHA1 of commit. Please help!!