2017-02-26 198 views
0

我有一个git仓库 - 让我们把它叫做A,在github上用远程。我有另一个回购 - B.是否可以将git仓库推送到另一个仓库(例如,github页面)的文件夹?

是否有可能设置一种方法将A推入B中的子文件夹?

例如,我有一个用html/js/css编写的项目。我想有一个独立的github回购项目,以及在我的github页面回购站,在一个子目录(例如,作为broshen.github.io/project/index.html)

我将如何设置这个?

+0

你可以使用git submodule。将项目'A'添加为项目'B'的子模块。 https://git-scm.com/docs/git-submodule –

回答

0

您可以添加一个在回购B中的子模块,但你需要提交在B中的子模块的更新要更改部署的任何时间。

既然你提到broshen.github.io/project/index.html,似乎值得一提的是,你可以添加一个gh-pages分支(或者其配置为使用docs/)自动部署到username.github.io/reponame/(从gh-pages部署例如https://dahlbyk.github.io/posh-git/)。

+0

哦,整洁!我结束了与github页面解决方案。 – broshen

0

将项目A添加为项目B的子模块。

# go into project 'B' 
$ git submodule add <repo-A-url> 
$ git submodule init    # intitialize the submodule 
$ git submodule update   # update all the changes/commits of submodule 

More Submodule

+0

[专业Git书有子模块章节](https://git-scm.com/book/en/v2/Git-Tools-Submodules)。 – Schwern

相关问题