Reputation: 324
Greetings,
I recently set up a GitHub repository and installed Git on my system. Until now I have used AnkhSVN and Tortoise with Google code repositories and I am having some difficulties understanding some parts of Git.
For testing this system I tried deleting a couple of files from my project folder and used pull and clone in order to get those files back from the repo. The problems encountered were: "Already up-to-date." when using pull and "fatal: destination path 'Project' already exists and is not an empty directory." when using clone
I managed to get the latest files by deleting the entire folder and using clone. Is there a way for clone to automatically overwrite any existing contents in the directory?
Cheers
Upvotes: 3
Views: 7504
Reputation: 9922
Git has the full history locally. You need not pull or clone to get the files back. As it sounds like you haven't committed the deletions, git reset --hard
is one of the standard recommended ways to get them back. This just restores the working directory (and index of "staged changes to be committed") to the revision given, which defaults to "HEAD".
git checkout -f <branchname>
should also work.
Upvotes: 3