The only way you can restore a deleted .git
folder is by:
- Cloning it again from somewhere
- Checking your recycling bin or backup (if no remote repository exists)
Since your files are from the online github repository, then its simple. Just clone it again from the directory where you deleted the .git
folder:
git init
git remote add origin <repo_address>
git pull origin master
where repo_address
can be git@github.com:yourname/yourproject.git
Your local checkout will be back to normal.
If you have uncommitted changes in your working copy you would want to keep, instead of using git pull
use git fetch
and then git reset --soft
your local branch to the remote branch it should be at. The soft reset will not change your working copy