Reputation: 10917
my project files unfortunately deleted while using cursor wrongly pressed then i realised my project not deleted. i get each files previous version of my git.my project commited only in local git but not in github.com. i can see my project files in vs code commits(all what i want).i tried all the things but i cannot get my last commit and i cannot overwrite and cannot get all deleted files in my local folder.
the above image show where my files stored in my last commit i want every deleted files and overwrite all the changed files.
i tried but not work for me
git reflo
git reset --hard 9a0ffad
Upvotes: 0
Views: 198
Reputation: 10917
My Hash was wrong,i got all deleted and changed source file
before i tried
git reflo
git reset --hard 9a0ffad<------this hash was wrong
after (corrected hash )
git reflo
git reset --hard 5e0ffad<------after i changed correct hash
Upvotes: 0
Reputation: 41955
Did you delete files, or commits?
If only the files are gone: git checkout <your local branch>
If this doesn't work, maybe git complains about unsaved changes, try this:
git checkout -f <your local branch>
or
git reset --hard
If commit disappeared, this gives you some kind of history of your previous git commands, with SHA1 number to commit that "disappeared": git reflog
. These commits are probably still accessible and you can try to run git checkout
on them.
Upvotes: 1