We have several config files in a project that 3 people are working on. However, those config files contain several lines that differ for each of us and so should not be changed or overwritten by commits. Yet Git won’t let us pull changes from the other people unless we commit those config file changes which then means that it changes the other members configs again.
Being new to Git it seems that we either need to create branches and merge them every commit to update our code – or use .gitignore. What is the proper way to handle this situation? We all need constant access to the changes that the other members make.
Tracking an example config file is generally a good approach. You can then have an untracked local copy. You can use githooks to help you apply the differences. You can have the post-merge and post-checkout (and maybe even post-commit) recopy the tracked to the untracked, and possibly apply changes to create your customized version. How exactly you do the last bit is up to you – it’s a script. A few calls to
sed -imight do it though.Another possibility, if you are able to use two config files, or the config files have some sort of “include” directive, is to have one tracked and one untracked.