I’ve just started learning how to use git today, progressing well.
As an experiment, I used push to upload two directories (containing two files each) and two files in the root directory. This worked fine.
I then deleted one of the two directories that I have locally (but not on git). When I use git status it seems to be aware of this:
deleted: test/Testfile.as
deleted: test/Testile2.as
But when I use git pull to get my files back, they don’t seem to return to my local folder. I’ve also tried git fetch.
The only way I seem to be able to get everything back is git clone, but that doesn’t seem logical as I need to delete my master directory locally and then clone it back again (or alternatively specify a new location for the cloned files).
What is the appropriate way to retrieve files and folders from github that have been deleted locally?
git pulljust merges the fetched commits in your working directory and will not restore your deleted directory ( but might warn you about conflicts.)If you have deleted the folders in your working directory, you have to do:
to get it back.
Or you can do
git reset --hardto completely bring your working directory to HEAD state.