git commit config on initial commit but never again?

前端 未结 1 1809
陌清茗
陌清茗 2020-12-06 03:29

I have started to use git for my projects, when I create a project it has a config folder containing configuration files:

application/config/config.php
appli         


        
相关标签:
1条回答
  • 2020-12-06 03:58

    You could, once versioned, update their index:

     git update-index --assume-unchanged application/config/config.php
    

    Or you could even update the index more permently:

     git update-index --skip-worktree application/config/config.php
    

    (as show in "git update-index --assume-unchanged and git reset")


    The other solution is to not version those final config file (since their content may vary as you pointed out), but to use a filter driver:

    filter driver

    You would versioned:

    • template files (application/config/config.tpl)
    • config value files (one default, and other for your different environments)
    • a script able to recognize the content of a config file (since it won't have its path) and generate the final config files according to the current environment.
    0 讨论(0)
提交回复
热议问题