tags:

views:

63

answers:

2

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...

+3  A: 

Common practice seems to be to create a devtargets.default.rb and commit it, and then instruct each user to copy that file to devtargets.rb (which is on the .gitignore list). For example, CakePHP does the same for its database configuration file which naturally changes from machine to machine.

erjiang
You can't .gitignore a file that is being tracked. .gitignore only has an effect for files that aren't in the index.
Charles Bailey
i was trying to avoid doing this, though i really don't have a good reason. we're doing it now and i think it's a pain to remember that i need to create my own version without ".default" in the name.
Derick Bailey
+2  A: 

Sure, I do exactly this from time to time using git update-index --assume-unchanged. Works great. Relevant documentation link.

Rob Wilkerson
hmmmm that could be exactly what i'm looking for! thanks rob! i'll try it out and back to ya. :)
Derick Bailey
Take a look at a post I wrote. It may help you decide whether it's what you're after: http://archive.robwilkerson.org/2010/03/02/git-tip-ignore-changes-to-tracked-files/
Rob Wilkerson