只下载更改过的文件 git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2245593/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Download only changed files git
提问by instigator
I have forked a project on GitHub and I want to download only the changed files from the original repo. Is it possible to do this?
我在 GitHub 上分叉了一个项目,我只想从原始 repo 下载更改的文件。是否有可能做到这一点?
回答by Doug Neiner
Yes and no. You have to get the whole repo, but when you merge it locally, it only brings in the changed files. There is a walkthrough here.
是和否。您必须获得整个 repo,但是当您在本地合并它时,它只会引入已更改的文件。这里有一个演练。
The important line is this:
重要的一行是这样的:
git remote add upstream git://github.com/original/repo.git
And then the actual fetching/merging can be done like this (two steps):
然后实际的获取/合并可以这样完成(两步):
git fetch upstream master
git merge upstream/master
or in one step:
或一步:
git pull upstream master
(Examples take from the GitHub link provided above)
(示例取自上面提供的 GitHub 链接)
回答by knittl
git fetch
(or git pull
to automatically merge)
git fetch
(或git pull
自动合并)