Why doesn't git pull bring back directories that I've deleted?

git pull just 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:

git checkout -- test

to get it back.

Or you can do git reset --hard to completely bring your working directory to HEAD state.


you want to return your repository to the previous working version. this is a job for git-reset.

git reset --hard

be sure to read through this useful explanation of git-reset

you could also check out those files if you wanted to:

git checkout -- test/

git pull will merge in changes. think of it like a file you've modified. a git pull doesn't replace the contents of the file with the remotes copy if you've modified it. even if there is a conflicting change, then it just warns you of a fastforward.

If you have your repository in a state where the delete is the only uncommitted change, and you want to undo it, then do a git reset head --hard

Or, if you have other changes you want to leave in place, do git checkout -- test


Apart from git pull and git checkout, git revert also will be helpful to get back the deleted files