0

最近我从 SVN 迁移到 GIT,使用git-svn.

签出代码的实际大小约为 24GB。在 GIT 中,目前我只看到一次分支为origin/master. 因此,如果每个开发者克隆 master,他每次都需要拉 24GB,这是真正的痛苦。

所以,我需要将一些现有的位置标记为分支,以便可以直接签出,而不是完整的 repo。

项目回购结构如下:

/Docs/
/project-maintainance/
/main-project/
             /module1
                    /branch1  
                    /branch2  
             /module2
                    /branch1  
                    /branch2
                    /branch3

现在,为了完成这个任务,我想将一些特定的文件夹标记为分支,而不是创建新的分支。我浏览了很多网页,但这只会增加我的困惑,因为我是初学者。

如何从子文件夹而不是顶级文件夹创建分支?

编辑:现在我的目标是能够checkout multiple subtrees, push and pull changes.

4

1 回答 1

0

Unfortunately, git does not work like this as it is a distributed version control system (DVCS). This means that you have an entire copy of the code and not just part of it.

However, it is possible to do what is called a shallow clone. For example:

git clone <repo> --depth 1

This approach comes with various caveats - you can find plenty more discussion here.

Ultimately, 24GB is extremely large for a git repo. In fact I've never heard of such a large repository before. It may be worth investigating trying to drastically reduce it in size using the filter branch command.

I have written a Ruby gem - which is still in early development - that provides some basic stats about your git repository such as large files in your history (and no longer in your working copy) that may be suitable candidates for removal using filter branch.

Another option could be to split your single repository into multiple ones. I can't strongly recommend this as I don't know how your code fits together, but there is a great discussion here.

于 2013-02-21T10:55:14.017 回答