问题
Is there a way to update folder or file alone in Git? I had cloned from central repository and wish to update only specific folder/files.
回答1:
you can use git fetch
to update the objects in your local clone, and then you can git checkout
those particular files.
For example - if your remote is called origin and you only want to update main.c
from the master branch you can do this:
git checkout origin/master main.c
This will update the file in your working directory and add it to the index ready to be committed on your local branch.
回答2:
No, you can only fetch/pull commits, which will affect the entire repository.
来源:https://stackoverflow.com/questions/6138817/how-to-update-particular-folder-file-from-central-repository-in-git