如何复制包含只有一个子文件夹的git存储库? [英] How to copy git repository including only one subfolder?

查看:88
本文介绍了如何复制包含只有一个子文件夹的git存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从现有的仓库创建一个新的git仓库,新仓库应该只包含位于指定子文件夹中的文件,并且只提交影响这些文件的提交?

  git filter-branch  -   git filter-branch  - 子目录 - 过滤器foodir  -   - 全部

(取自 git文档


Is there a way to create a new git repository from an existing one, the new repository should include only files located in the specified subfolder and only commits that affects these files?

解决方案

I think you are looking for:

git filter-branch --subdirectory-filter foodir -- --all

(Example taken from the git documentation)

这篇关于如何复制包含只有一个子文件夹的git存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆