git push 分支 选定文件夹下内容推送
迷茫
迷茫 2017-05-02 09:23:48
0
3
635

在一个项目中如下图

git add .
git commit -m "all"
git push 

上面会把所有的添加到 master 分支上,

但我希望 吧 examples 的目录下的 所有文件 都 添加到 gh-pages 分支 ,以便好做 演示

不希望在 examples 目录下 建立一个 git init

git push origin gh-pages

会把项目所有的文件都推送到 gh-pages

而我只想 gh-pages 分支 只有项目下 examples 文件夹下所有的文件 ,其他文件不需要

有木有其他 好办法呢 ! 求 git 大神支招!!

我要的是 项目所有的文件提交到主分支 ,项目文件夹 example 下的所有文件 提交到 gh-pages 的分支下

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

reply all(3)
滿天的星座

Step 1

Remove the dist directory from the project's .gitignore file (yeoman ignores the dist directory by default)

Step 2

Add dist directory to subtree:

git add dist && git commit -m "Initial dist subtree commit"

Step 3

Use subtree to push the dist directory to the gh-pages branch:

git subtree push --prefix dist origin gh-pages

In this example, replace dist with example.

伊谢尔伦

Use git push origin gh-pages
origin is the name of your remote warehouse,
gh-pages is the name of the branch you want to push

为情所困
git checkout gh-pages
git checkout master -- example
git push origin gh-pages
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!