One of the most common issue we all face when versioning code on source repositories is being able to make changes to files that are tracked, but without committing them.
A typical example is the
web.config file in Umbraco projects: the version in source control should be the default "uninstalled" version, while each developers will have its own, with it's local configurations.
Probably some of these scenarios could be solved with other approaches, like writing
.user config files, but a solution that solves all of these issues is using the
update-index command of git.
You can type
git update-index --assume-unchanged <file> to temporarily exclude the file from any tracking, pretending it never changed. And when you actually need to commit some actual change to the file you can use the opposite command
git update-index --no-assume-unchanged <file>.
The only annoying problem is that I cannot find a way to list which files are untracked. But it nicely solves the problem of making configuration changes that we don't want to commit in a way that is transparent for the solution being developed.
Have you ever used this approach before? What do you think? Let me know in the comments.