提取git存储库的一部分? [英] Extract part of a git repository?

查看:90
本文介绍了提取git存储库的一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我的git仓库具有以下结构:

  /。git 
/ Project
/ Project / SubProject-0
/ Project / SubProject-1
/ Project / SubProject-2

和存储库有相当多的提交。现在其中一个子项目(SubProject-0)增长很大,我想将SubProject-0取出并将其设置为独立项目。是否有可能从父git存储库中提取涉及SubProject-0的所有提交历史记录并将其移至新的历史记录? =noreferrer> http://git-scm.com/docs/git-filter-branch



我认为你需要类似于

  git filter-branch --subdirectory-filter Project / SubProject-0 --prune-empty  -  --all 

存储在存储库的克隆中。


Assume my git repository has the following structure:

/.git
/Project
/Project/SubProject-0
/Project/SubProject-1
/Project/SubProject-2

and the repository has quite some commits. Now one of the subprojects (SubProject-0) grows pretty big, and I want to take SubProject-0 out and set it up as a standalone project. Is it possible to extract all the commit history involving SubProject-0 from the parent git repository and move it to a new one?

解决方案

See http://git-scm.com/docs/git-filter-branch

I think you need something like

git filter-branch --subdirectory-filter Project/SubProject-0 --prune-empty -- --all

in a clone of the repository.

这篇关于提取git存储库的一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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