I am new to git/github and have started using it recently.
I have a project in git that has a few commits, however , I forced a push into git using git push -f origin master and now, i have lost all previous commits and only have one that was pushed recently.
How do i retrieve restore my project to previous state in git?
Things that I have done: git reflog (This doesn't give me previous commit details)
213bcde HEAD@{0}: revert: Revert "V3 files" cb24c10 HEAD@{1}: reset: moving to HEAD cb24c10 HEAD@{2}: reset: moving to cb24c103e6c0400760a20098a2baceb0601bb858 cb24c10 HEAD@{3}: checkout: moving from master to master cb24c10 HEAD@{4}: commit (initial): V3> files
I need to get to a commit beyond cb24c10 head@{4}: commit (initial): V3 files
git revert HEAD --no-edit
git show This shows details only of the current commit SHA
git fsck --no-reflogs
This provides me a dangling blob and I am not sure if this is a reference to my old commit
Checking object directories: 100% (256/256), done. dangling blob e6a2438a4750e9cda68ce2d916c1b8a65dcc5384
Please can someone assist in letting me know next steps to restore my project to previous state.
Unfortunately, I haven't closed my terminal window and I can have the SHA of previous commit b0b7eba. How do I restore to this state?
git push -f origin master Delta compression using up to 4 threads. Writing objects: 100% (507/507), 13.55 MiB | 7.17 MiB/s, done. Total 507 (delta 109), reused 0 (delta 0) remote: Resolving deltas: 100% (109/109), done. To https:http://.filename.git + b0b7eba...cb24c10 master -> master (forced update)