Reputation: 149
I created a new repo in github and cloned it inside my already existing project directory in my machine. I migrated specific folders into the cloned project and added a .gitignore to ignore images and track only folders with .py and .ipynb files in it.
When I
git status
I only saw that I can add .gitignore and not the folders that contain the files I want. I pushed it to github and (as expected) saw only .gitignore added in my remote repo.
I thought I cannot add the folders with files I want so I would like to revert to original state (without the gitignore).
Unfortunately, I did
git stash
Now, my original .py and .ipynb files that are not written in .gitignore are gone. How can I retrieve them? I do not have duplicate copies of the project.
Upvotes: 1
Views: 1306
Reputation: 768
If the untracked files were inside the directories you put in .gitignore
, then it's probably lost (I encountered this problem when i put directories to be ignored as dir/*
format instead of dir/
in the .gitignore
file.
I believe this bug has been solved in version 2.14.0
(https://github.com/git/git/blob/master/Documentation/RelNotes/2.14.0.txt#L384)
Upvotes: 0