git checkout and git pull do not download files

advertisements

I've git pulled from a remote repository, and I think it worked, but at one point I deleted a couple of files and now I want them back. The thing is, I have a feeling git thinks they're already there, because it gives a list of files with 'D' on the right of them. these are the files I need to download, but they're just not there in the folder!

How can I simply download all the files? On bit bucket, it lists all the files perfectly. I just want to download these files.


The files should still be in your local copy of the repo. Git pull isn't going to get them for you because you still have them.

Assuming you committed their deletion, "git checkout" those files from an earlier version of the repo.

However, since you say it lists them with a 'd' next to them, I assume you haven't, which means you simply need to checkout the deleted files again. For specific files, typing git checkout -- [filename] will do that for you. It checks out the specific file from the current index.

If you want to do undo all your changes, you can $ git reset --hard HEAD, although that will also get rid of any other changes you've made in addition to the file deletion.