git subtree push the specified folder to the specified branch

For example, a git project has three parallel directories p1/, p2/, p3/. As the development process progresses, it is found that the code or files of these three directories are very low and are actually independent. For example, it is best to use branches p1proj, p2proj, and p3proj to manage them. The original master branch remains. Use git subtree to manage files through branches.

git subtree push --prefix p1 origin p1proj
git subtree push --prefix p2 origin p2proj
git subtree push --prefix p3 origin p3proj

The most common is to write vuepress documents. Usually the location of the document is in the docs/.vuepress/dist directory of the project, and the place where our document is deployed is the gh-pages branch in Github, so you can execute the following command to push the document to gh- The pages branch.

git subtree push --prefix docs/.vuepress/dist origin gh-pages

Currently my project has master branch and gh-pages branch, and some files in the master branch used by gh-pages branch, so when you modify the document in master, push the gh-pages branch after submission Yes, the codes on both sides can be kept consistent.

Guess you like

Origin blog.csdn.net/wu_xianqiang/article/details/107173240