[英]Can I make the gh-pages branch of my git repository a mirror of the Master branch?
GitHub has a Project Pages feature that pulls from the gh-pages branch of a repository. GitHub具有项目页面功能,可从存储库的gh-pages分支中提取。 It's explained here: http://pages.github.com/ 在这里说明: http : //pages.github.com/
I want the gh-pages branch to be an exact mirror of the Master branch. 我希望gh-pages分支完全是Master分支的镜像。 One way I found ( here on Stack Overflow) is to run: 我发现(单程这里对堆栈溢出)是运行:
git config --add remote.origin.push +refs/heads/master:refs/heads/gh-pages
This causes each instance of git push
to push the Master branch of the repository into the gh-pages branch. 这导致git push
每个实例将存储库的Master分支git push
送到gh-pages分支。
The trouble that I have with this solution is that I'm using the GitHub Mac App, which doesn't use a strict git push
. 这种解决方案的问题在于我使用的是GitHub Mac App,它没有使用严格的git push
。 According to http://mac.github.com/help.html it does a git pull --rebase
. 根据http://mac.github.com/help.html,它执行git pull --rebase
。 Additionally, even when I select Push
from the Repository menu, my git config line isn't adhered to. 另外,即使我从“存储库”菜单中选择“ Push
”,我的git config行也未遵守。
So, I'm wondering if there is a way that fits well with the GitHub Mac App to get the gh-pages branch be an exact mirror of the Master branch. 因此,我想知道是否有一种方法与GitHub Mac App完全匹配,从而使gh-pages分支成为Master分支的精确镜像。
I ran through a bunch of my own tests. 我进行了一系列自己的测试。 It doesn't seem like you need to go through the exact process they've laid out at http://pages.github.com/ in order to create the gh-pages branch. 为了创建gh-pages分支,您似乎不需要经历他们在http://pages.github.com/上列出的确切过程。 You can simply create a new branch named gh-pages from within the GitHub Mac App. 您可以在GitHub Mac App中简单地创建一个名为gh-pages的新分支。
They probably don't instruct people to do this because what I'm accomplishing here isn't a typical scenario. 他们可能不会指示人们这样做,因为我在这里完成的工作不是典型的情况。
You can take these steps to create the 'gh-pages' branch from within the GitHub Mac App: 您可以按照以下步骤从GitHub Mac App中创建“ gh-pages”分支:
+
button on your Master branch to create a new branch - name this 'gh-pages' 点击您的Master分支上的+
按钮以创建一个新分支-将其命名为“ gh-pages” Publish
button to push it to GitHub 单击Publish
按钮将其推送到GitHub Take these steps to sync your changes from the Master branch into the gh-pages branch: 采取以下步骤将您的更改从Master分支同步到gh-pages分支:
Commit & Sync
button to push to the Master branch 在“更改”视图中,输入提交摘要,然后单击“ Commit & Sync
按钮以推送到“主”分支 Merge View
button to display the Merge view 单击Merge View
按钮以显示合并视图 Merge Branches
button 单击Merge Branches
按钮 Branch in Sync
button to force a synchronization 单击“ Branch in Sync
按钮以强制同步
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.