I have a need to keep 3 branches in 3 separate folders. (I know this is not a git way of doing things. But I need to do this for a reason).
Lets say the repo name is
The above scenario as put up in the question, is pretty much valid in following scenarios.
Micro-services: AWS Lambda development for example one or two develop work on an lambda, there are say 70 lambdas total. Thus, 70 folders including test and code_folder. If it was a monolithic system, you have to make sure all parts of system work together by having zero merge issue. But here each of 70 folder is independent except few global configuration and few shared folders.
Monorepo: Large companies use monorepo to manage all sub-projects of a larger project including mobile app, websites, backend and other related stuff.
Master branch may or may not have all the code, if each branch track only changes in its folder.
One way to do it, first create a shared branch for shared modules. Then, create multiple branches where each branch starts with empty folder. Never merge your branch with master, only pull shared branch merge your branch locally and push to remote branch.
Thus, every branch on remote has shared modules and your code.