As shown below in a project
git add .
git commit -m "all"
git push
The above will add everything to the master branch,
But I hope that all the files in the examples directory will be added to the gh-pages branch for easy demonstration
Do not want to create a git init
git push origin gh-pages
will push all project files to gh-pages
And I only want the gh-pages branch to have all the files in the examples folder under the project, other files are not needed
Is there any other good way? Please give me some advice from the git master! !
What I want is to submit all the files of the project to the main branch, and all the files under the project folder example to be submitted to the branch of gh-pages
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:
Step 3
Use subtree to push the dist directory to the gh-pages branch:
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