Can I create a GIT fork with limited branch set

This question already has an answer here:

  • How to clone a single branch in git? 14 answers

  • It kind of depends on what you mean about only wanting certain branches. Or, more to the point, on what you're hoping to gain from only having certain branches.

    If it's as simple as wanting a shorter list of refs when you git branch --list --all , then Alejandro Montilla's suggestion (fork then delete branches) should work.

    If the parent repo has significant size bound up in unmerged branches and you want to reclaim that space, that's a little harder. You'd have to make sure after the branches were deleted that gc cleaned it up. You can always gc a local repo, but when it's hosted on a service, they may or may not offer control over garbage collection.

    Maybe you want something even more complicated... many people seem to find a history that preserves the original branch topology to be "messy" and they want to "clean it up" - much of the motivation behind various rebasing operations. This would require getting rid of not only merged branches, but the commits in (one line of) the merge's history. There's not an easy way to do this to an existing history (and if you do, any relationship between the resulting repo and the parent repo would be irrevocably lost). So if that's what you're after, you might consider re-framing the problem in terms of how to get better looking log output for the history as it exists.

    链接地址: http://www.djcxy.com/p/90444.html

    上一篇: 如何将Git浅层克隆转换为完整克隆?

    下一篇: 我可以使用有限分支集创建GIT分支吗?