我可以删除基于 gh-pages 分支的子模块中的本地 master 分支吗
我有一个 Github 项目,其中的文档是自动生成的。 我已经创建了包含这些文档的目录的子模块;子模块对应于 gh-pages 分支(参见 http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html ),在推送任何更改后,我会自动在线发布文档。
假设我的本地 git repo 位于 ~/project 中,然后
$ cd ~/project
$ git br -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/gh-pages
remotes/origin/master
假设子模块位于 ~/project/docs/build/html 中,那么
$ cd docs/build/html
$ git br -a
* gh-pages
master
remotes/origin/HEAD -> origin/master
remotes/origin/gh-pages
remotes/origin/master
我的主要问题是:我可以
$ git branch -d master
在不搞砸事情的情况下做吗?
第二个相关问题(这表明我对 git 还不了解)是让 HEAD 指向 gh-pages 是否有意义,即,最终以
$ git br -a
* gh-pages
master
remotes/origin/HEAD -> origin/gh-pages
remotes/origin/gh-pages
remotes/origin/master
If it is possible and Means sense: What are the (dis)优点?
I have a Github project in which the docs are generated automatically.
I have made a submodule of the directory that contains these docs; the submodule corresponds to the gh-pages branch (cf. http://blog.blindgaenger.net/generate_github_pages_in_a_submodule.html), which after pushing any changes results in me automatically publishing the docs online.
Assume my local git repo is in ~/project, then
$ cd ~/project
$ git br -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/gh-pages
remotes/origin/master
Assume the submodule is at ~/project/docs/build/html, then
$ cd docs/build/html
$ git br -a
* gh-pages
master
remotes/origin/HEAD -> origin/master
remotes/origin/gh-pages
remotes/origin/master
My main question is: can I do
$ git branch -d master
without mucking things up?
A second, related question (which shows what I do not know about git yet) is whether it makes sense to let HEAD point to gh-pages, i.e., end up with
$ git br -a
* gh-pages
master
remotes/origin/HEAD -> origin/gh-pages
remotes/origin/gh-pages
remotes/origin/master
If it is possible and makes sense: what are the (dis)advantages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在子模块内部,是的,您可以,因为这只会在该子存储库中删除它。
您不应该将删除推送到远程
master
,因为那是项目origin/master
。将
origin/HEAD
更改为指向origin/gh-pages
可能不是您想要的。这可能会影响该项目在 github 上的默认分支。Inside the submodule, yes you can since that will only delete it in that sub-repository.
You shouldn't push the delete to the remote
master
since that's the projectsorigin/master
.Changing
origin/HEAD
to point toorigin/gh-pages
may not be what you want. This might effect which is the default branch on github for the the project.