git:把一个分支放在一个子目录中 [英] git: put a branch in a subdirectory

查看:452
本文介绍了git:把一个分支放在一个子目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git仓库(在github.com上)有两个分支:master和gh-pages。我希望在子目录中有gh-pages分支,这样我就不需要每次都切换分支。

  repo / 
(master分支的内容)
gh-pages /
(gh-pages分支的内容)

这可能吗?

解决方案

工作。理论上,您可以在原始克隆的子目录中克隆该存储库,并将该目录标记为从较高级别存储库中排除,但是要在完全不同的目录中检查它而不是子目录?



也就是说...

  / repo / master /(master分支上的克隆)

然后另一个分支上的另一个克隆

  / repo / gh-pages /(克隆在gh-pages分支上)


I have a git repository (at github.com) with two branches: master and gh-pages. I would like to have the gh-pages branch in a subdirectory, so that I don't need to switch branches every time.

repo/
    (content of the master branch)
    gh-pages/
            (content of the gh-pages branch)

Is that possible ?

解决方案

That's not how things are designed to work. You could theoretically clone the repository within a subdirectory of your original clone and mark that directory as excluded from the higher level repository, but wouldn't it be much simpler to just check it out in a completely different directory instead of a subdirectory?

That is to say...

/repo/master/(clone on master branch)

and then another clone that's on the other branch

/repo/gh-pages/(clone on gh-pages branch)

这篇关于git:把一个分支放在一个子目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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