Git - How do I manage built files in different branches?

后端 未结 5 605
滥情空心
滥情空心 2021-01-07 23:21

Some Background

I have been using Git for a while now. The projects that I have been working on have not been too complicated in regards to branches/tags.

5条回答
  •  清酒与你
    2021-01-08 00:05

    Okay

    So this question has been unanswered for a while now and I just been trying different solutions locally.

    The best one I came up with is to use pre amd post checkoout hooks.

    Here is what I have done

    1. Create a .binaries folder at the top level of your repository and add it to the .gitignore file.

    2. Add the file formats of the binaries to your .gitignore file also.

    3. write a script in your favorite scripting language to find all files of said format that moves them to the .binaries// folder under the same path structure e.g. src/library1/lib1.o should be MOVED to .binaries//src/library1/lib1.o - this should be called by pre-checkout

    4. Write a script to move files from the .binaries folder into the current branch e.g. .binaries//src/library1/lib1.o should be MOVED to src/library1/lib1.o - this should be called by post-checkout

    Now switching between branches will revert to the binaries that were built during for that branch only and you will have a clean checkout when creating a new branch.

提交回复
热议问题