Keep settings in branch

后端 未结 3 2016
抹茶落季
抹茶落季 2021-01-14 16:35

I begin to use git for software development.

I have a project on github. This project also involves some user-settings stored in dedicated settings-files.

On

相关标签:
3条回答
  • 2021-01-14 17:13

    You can create a setting file like setting-sample, and modify .gitignore to ignore the real setting file (i.e. setting). So the empty setting file will be kept in remote repo, and your personal setting file will be kept in your local repo.

    0 讨论(0)
  • 2021-01-14 17:32

    You may commit the empty settings file and then commit a .gitignore file pointing to the original file, so in that case, the users would download the file but git will ignore the changes that users make.

    0 讨论(0)
  • 2021-01-14 17:33

    In your personal branch, you could keep:

    • the GitHub config file unchanged (with no value), but with a different name (config.template for example)
    • a "value file" with your personal value
    • a "smudge" script able to generate the actual config file using the template one and your personal values

    That script is triggered on any git checkout as a content filter driver.

    enter image description here

    That way, you can merge master onto your personal branch as many time as you want, your config values will not be modified.

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