How To Keep Git From Committing Changes to Web.Config
Articles
Written by Todd E. Qualls   
Thursday, 19 July 2012 10:57

When working with another developer on the same app and working off of a localhost db, I get tired of having to change my connection string in web.config every time he changes his conn string to match his local environment (Note: the other dev has to follow this practice as well or this approach will not work).

So to avoid that, I use these two GitBash scripts to toggle the tracking of web.config. That way I only commit web.config when there are changes to the file other than dev conn string changes.

Now, you will get an error when you do a pull from the repo when the other dev has made substantive changes to the config file, if you are still running in the "ignore mode" set by ignore-config.sh script. However, just run commit-config.sh, tell git to commit your local changes and then do your pull from the repo again. You may get a merge conflict, so work through that as you normally would, commit your changes, then run ignore-config.sh again to stop tracking your config changes going forward.

Last Updated on Thursday, 19 July 2012 11:55
 
 

Twitter (@teqKnowledgy)

GitHub (tqheel)