【发布时间】:2018-07-07 04:15:52
【问题描述】:
我在 Github 上有一个 git repo,看起来像这样:
.git/
assets/
tools/
a.sh
b.sh
c.sh
当然 .git 文件夹不在版本控制中,但你明白了。我想将 tools/*.sh 复制到本地目录,在这个路径:
./scripts/git/tools
我当前的目录是一个 git repo,它与远程 git repo 共享完全不同的历史记录,我只想从远程复制一些文件,我不想合并任何东西。
我想我可以这样做:
git clone --path assets/tools/*.sh "$remote_repo" ./scripts/git/tools
但是那个命令不是真的,有什么命令可以用来做这个吗?
我能想到的唯一其他方法是将整个 repo 克隆到某个临时目录,然后将文件复制过来,但这并不那么有趣。
【问题讨论】:
-
这可能对学习如何削减大型回购的脂肪有用:atlassian.com/blog/git/handle-big-repositories-git
标签: git git-clone git-subtree