Can I ‘git commit’ a file and ignore its content changes?

Every developer on my team has their own local configuration. That configuration information is stored in a file called devtargets.rb which is used in our rake build tasks. I don’t want developers to clobber each other’s devtargets file, though.

My first thought was to put that file in the .gitignore list so that it is not committed to git.

Then I started wondering: is it possible to commit the file, but ignore changes to the file? So, I would commit a default version of the file and then when a developer changes it on their local machine, git would ignore the changes and it wouldn’t show up in the list of changed files when you do a git status or git commit.

Is that possible? It would certainly be a nice feature…

5 Answers
5

Leave a Comment