Git - separate folder for each branch. Setting it up

前端 未结 4 1737
鱼传尺愫
鱼传尺愫 2021-02-01 10:08

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

4条回答
  •  北海茫月
    2021-02-01 10:19

    The above scenario as put up in the question, is pretty much valid in following scenarios.

    1. 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.

    2. 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.

提交回复
热议问题