如何从提交树的底部创建一个新的 git 分支,它与主分支没有共同的提交?对于 gh-pages

How can I create a new git branch from the base of the commit tree , which has no commit in common with master branch ? for gh-pages

我想在 master 分支的基础上创建一个新分支,这样新分支没有与 master 分支相同的提交。

the new branch will be totally different from the master branch, and never to be merged to master

我想这样做是因为我想创建一个 gh-pages 分支来托管我的站点。当我在 GitHub 设置中点击选择主题时,它创建了这样一个梦想分支。但是如何从命令行创建这样的分支??

如果你想创建一个完全空的分支,你可以使用 git 命令的孤立选项:

git checkout --orphan gh-pages

然后您可以添加您的提交并将新分支推送到存储库。还有several ways可以用。它们在此处进行了描述。