git - How to manage configuration files when collaborating? -


i'm writing short script few simple variables @ top of page. want work on them friend, aren't sure how manage variables needing changed after pulling each time 1 of us, adding unnecessary junk git status. thought creating different named branches each of us, , master have example usernames set, seems silly have work merging. have variables passed script options, isn't desired, nor separating out separate configuration file. great have .gitignore ignore few lines in file.

how can elegantly managed? how problem managed?

you can't ignore changes particular lines of file, i'm afraid, you're stuck having separate configuration file. below i've listed 2 typical ways of dealing this, , 1 more exotic one:

have sample configuration file in git

here, keep file config.sample in git example, application use values in file config in .gitignore. application produce error unless config present. have remember change values in sample file when add new configuration variables personal config file. in case it's idea have application check required configuration variables set, in case has forgotten update config file after changes sample.

have file of default values in git

you keep file config.defaults in git, has sensible default configuration values far possible. application first sources configuration config.defaults , config (which in .gitignore) possibly override of default values. method, typically wouldn't make error config not exist, application can work out of box people haven't bothered create config.

using single configuration file --assume-unchanged

a third possibility, wouldn't recommend in case, personally, have single configuration file committed in git, use git update-index --assume-unchanged <file>, tell git ignore changes it. (this described further in this useful blog post.) means local changes configuration file won't committed git commit -a or show in git status.


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -