What is the right way to maintain a “version for the server” - with only config files changed, in Git?

前端 未结 3 903
北恋
北恋 2020-11-22 04:35

I sometimes work with Codeigniter, and after I\'m done developing on the local site, I need to migrate the files to the server. All the files in the /config/ fo

3条回答
  •  没有蜡笔的小新
    2020-11-22 04:54

    You could keep versioned:

    • two "value config files", with the right values for each environment
    • a template config file, with value placeholder in it (for instance, @@PORT_NUMBER@@)
    • a script able to generate the actual config file depending on the current environment
    • a content filter driver which, on checkout, will trigger the script in order to generate the right config file.

    content filter driver

    Note: that supposes your template config file has a recognizable content (the filter doesn't have a name or path of the file). See "Git equivalent of subversion's $URL$ keyword expansion" for more on the limitation of git content filter driver).

提交回复
热议问题