I copied a project and edited it to create a new project. I made a lot of changes. After 3 months, I tried to push to the repository.
Pushed to the older repository. (All code was fine and complete.)
git reset --hard HEAD^
git push origin -f
these were implemented to the older repository. (It removed the last commit from GitHub but I didn’t noticed it removed from local as well.)Deleted .git folder. Then created new repository and pushed code to that new repository.
As I said I didn’t noticed local data was also changed. That changed data was pushed to the new repository.
I lost my important data of 3 months.
Alot of blogs and answers suggested to use
git reflog show
as git was removed from project and new repository was linked. The older repository was cloned and implemented this command but didn’t showed any changes or HEADs.
git fsck --lost-found
I tried this one as well but didn’t worked.
.git folder deleted from the older project was also removed from trash.