我可以删除基于 gh-pages 分支的子模块中的本地 master 分支吗

发布于 2024-12-22 10:10:59 字数 1055 浏览 0 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断舍离 2024-12-29 10:10:59

在子模块内部,是的,您可以,因为这只会在该子存储库中删除它。

您不应该将删除推送到远程 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 projects origin/master.

Changing origin/HEAD to point to origin/gh-pages may not be what you want. This might effect which is the default branch on github for the the project.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文