Reputation: 4794
This is the situation: We have several configuration files, and when a user clones the repo it is expected they will modify these configuration files. The files themselves are structured to make this quick, simple, and easy - but it means that any user doing a "git add *" or "git commit -a" ends up sending them back to the server with the changes already made!
Not only does this break things for the next person next time he pulls (he'll need to merge every time and handle the conflicts for a file he shouldn't even need), it means a user can very easily accidentally break the continuous integration testing we've got going.
What I want is the effect of git ignore (it doesn't care if it gets changed, it won't commit it), but without having to remove the file completely. It would be nice if we could also force a change to the file somehow.
I know there are ways to do this in SVN, I figure Git must have an equivalent.
Upvotes: 3
Views: 342
Reputation: 11831
I'd do configfile.template
, with configfile
listed in .gitignore
, and a README or other hint at copying and adjusting. Set up whatever is the target of said configfile
to do something sensible (builtin configfile.template
equivalent?) if no configuration extant (you'll need something like that anyway, so...).
Upvotes: 0
Reputation: 301527
git update-index --assume-unchanged <filename>
( it is intended for a different purpose actually - to improve the performance of git operations on not so optimal file system whereby you can instruct git to assume that certain files are not touched. You can use it to "temporarily" ignore tracked files)
You can also look at alternate ways in which people handle configuration files, like having a template config file that the users create their specific config file out of ( the latter being ignored) etc.
Upvotes: 6