Domanda

Forgive me I just started to use git. I have cloned the master on my local system using git clone. It works fine. When I tried to update my local clone using git fetch(before I tried it , I deleted some files in my clone for testing, and hope git fetch can download the deleted files from git again).It doesn't work.

I have a quick query how to update my clone from the master. I tried git pull. It did not work, the deleted files doesn't appear again. How I can update the clone? thanks.

È stato utile?

Soluzione

If you want to get the deleted files back, you can do:

git checkout .

What git fetch does:

git-fetch - Download objects and refs from another repository

Basically it downloads VCS updates from remotes. When you delete files from your work tree, they are not deleted from the repository. So for git fetch there is nothing to download, and it will do nothing when you run it.

What git pull does:

git-pull - Fetch from and merge with another repository or a local branch

Basically it does git fetch and a git merge.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top