Reputation: 468
So this is pretty embarrassing, and it's also a big problem for me.
I am new to git and Github. I figured I would start by downloading the Github desktop app to learn how things worked. I created a repository from a location on my hard drive (the root folder of the project), but then decided to delete this repository. For whatever reason, Github moved my actual project folder (the root folder) into my trash bin, but when I went in there the only thing in the root folder was one folder that I included in my .gitignore
file. Everything else seems to have vanished from my Mac, and I never even emptied the trash.
I have lost potentially 2 weeks of work, and have no idea what to do. I would not even know where to begin to fix this, and fear that my project is permanently lost.
Upvotes: 1
Views: 2452
Reputation: 425
It happened to me also. I made a new repository on location that my actual project is, did commit and I was unhappy with .gitignore so I just removed repository. This shouldn't remove project from disk (it says in info box before deleting). Then I went to make a new repository on same location but with different .gitignore properties and my project cleaned like I never even coded
This helped me - if there's commit, there's a history tab which should have commits. If in history tab there's no commits, remove repository again and create new repository again on that same location with gitignore as before when files existed. When you click of first commit, there will be files shown on the right. When you hover over each of them Github should say there's no files on disk but will still preview them on the right. Then you can publish repository and clone it afterwards or copy/paste each file into notepad.
That did trick for me but if you didn't do any commits, I don't really know how to help you. Make sure to backup projects in explorer before doing initial Git stuff because this is a nightmare.
Upvotes: 1