Automatically ignore selected code changes when pushing to a git-hub repository

后端 未结 1 1803
你的背包
你的背包 2020-12-18 10:45

In the types of coding projects that I work on, there is often a common code base that people use, and then build their own personalized code on top of it. A way to do this

相关标签:
1条回答
  • 2020-12-18 11:41

    If the personalization is limited to certain files, with a way to detect just be looking at its content, then you could:

    • version only template files, which would always be pushed to your "common content" repo
    • keep private value files (files with the right values in it, which are always ignored by your git repo and never pushed)
    • version script files able to take a template file, a value file, and generate the right valued end-result file automatically. That generated file wouldn't be pushed either, and would also be ignored by your git repo.

    The idea is to make that generation automatically on checkout.
    You do that by declaring a content filter driver.

    content filter dirver

    On checkout, in the smudge script, detect the content (those 'filter driver' scripts don't have the name of the files they are filtering) of a your template files, and generate the right content by looking for a value file in a specific path.

    0 讨论(0)
提交回复
热议问题