[英]How to add master branch folder to github pages?
Hello I have a github repository where I am writing some code and making a folder which contains some HTML. 您好,我有一个github存储库,我在其中编写一些代码并制作一个包含HTML的文件夹。
I have created a github page for my repo using github pages and which loads data from my README.md 我已经使用github页面为我的仓库创建了一个github页面,并且从README.md加载数据
So now I have 2 branches: 所以现在我有2个分支:
master
gh-pages
master
gh-pages
My master
branch has the following structure: 我的master
分支具有以下结构:
HTML/
IMAGES/
codeFiles.py
codeFile2.py
...
Is there any ways I can include just my HTML/
folder from my master
branch into my gh-pages
branch. 有什么方法可以将我的master
分支中的HTML/
文件夹仅包含到gh-pages
分支中。
What I am looking for is a structure like of my gh-pages
我正在寻找的是类似gh-pages
的结构
Images/
Javascripts/
Styles/
HTML/
index.html
...
Note I don't use gh-pages myself, so I haven't tried this exact scenario. 请注意,我本人不使用gh-pages,因此我没有尝试过这种确切的情况。 If you do this I strongly advise doing it in a new clone of the repository and checking both branches thoroughly before pushing any changes. 如果您这样做,我强烈建议您在存储库的新克隆中进行此操作,并在推送任何更改之前彻底检查两个分支。
You could do: 您可以这样做:
git checkout gh-pages
git read-tree master:HTML
git clean -df
git checkout .
git commit
All previous contents of the gh-pages
branch would be removed in the new commit, replaced by the contents of the HTML
directory from the current version of your master branch. gh-pages
分支的所有先前内容将在新提交中删除,由master分支的当前版本中的HTML
目录的内容替换。 This would not cause future changes to that content to be synced between those branches, but you could use the subtree merge strategy to merge changes to that shared content from the other branch: 这不会导致对该内容的将来更改在那些分支之间进行同步,但是您可以使用子树合并策略来合并对来自另一个分支的该共享内容的更改:
git merge -s subtree $other_branch
But this isn't likely to work as well as merges typically do in git because those branches still don't share any history, only some of the content. 但这并不能像git中的合并那样好用,因为那些分支仍然不共享任何历史,仅共享部分内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.