如何使用 git 拉取特定目录 [英] How to pull specific directory with git
本文介绍了如何使用 git 拉取特定目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个使用 git 的项目,我只想克隆或拉取特定目录,例如 myproject/javascript,就像 subversion 一样.
进行一些更改,提交并再次推回.
有可能吗?
I have a project with git, and I just want to clone or pull a specific directory, like myproject/javascript just like subversion does.
make some changes, commit and push back again.
It's possible?
推荐答案
- cd 到你的 repo 副本的顶部
git fetch
git checkout HEAD path/to/your/dir/or/file
(3) 中的
path/...
"从包含.../file
"的存储库根目录正下方的目录开始
Where "
path/...
" in (3) starts at the directory just below the repo root containing your ".../file
"
请注意,可以使用特定提交的哈希码代替HEAD",然后您将获得特定于该提交的修订(文件)或修订(目录).
NOTE that instead of "HEAD", the hash code of a specific commit may be used, and then you will get the revision (file) or revisions (dir) specific to that commit.
这篇关于如何使用 git 拉取特定目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文