Is there any way to set up different root directories for different branches of the same local warehouse? Because to write gitbook, you need to use the subfolder book as the root directory of the gitbook branch, and submit the code generated below to the gitbook branch. , and the master branch is used for writing. The book folder is ignored when submitting the master branch, so that it will not be confused when deployed on the server. Or is there any other better way?
Structure of master branch
(with the book folder as the root directory) The corresponding structure under the gitbook branch
git checkout --orphan gitbook
和git submodule
Using them in combination meets your requirements, but it’s a little troublesome.In fact, Git branches are not suitable for the need of "subfolders". Multiple Repos are more useful.
SVN’s branch model fits your requirements very well, but it may not be compatible with GitBook.
Of course, you can create a new empty branch to store separate structures.
But you should note that there is always only one active branch in a local directory, and there is no possibility of you operating two branches at the same time.
You might as well split it into two directories.
book
Are the contents of the directory generated by the build tool? Then you should be able to set the generation path, or write a command to migrate the directory files yourself. Finally, the book directory and the directory where the master branch is located are placed at the same level, so that there is no nesting of warehouses.