Suppose you work in a team. You download the project sources and you need to change some configurations according to your working environment, like the tcp port on which to run the webserver or the path where to store the log files. If you commit those files, after your local set up, this would impact the other members of your team when they update.
You cannot simply add them to .gitignore since those files need to be versioned. But you want just to avoid committing your local configuration to your repository.
So here we have a problem…

As far as I know, GIT is the only scm able to handle the issue. This is done by running the command:

$ git update-index --assume-unchanged path/to/file.txt

Once marking a file as such, git will completely ignore any changes on that file; they will not show up when running git status or git diff, nor will they ever be committed.

To make git track the file again, simply run

$ git update-index --no-assume-unchanged path/to/file.txt

Credits to GitHub Help pages for this awesome trick.

To cancel the effect of the --assume-unchanged run

$ git update-index --really-refresh

which does a real refresh ignoring the --assume-unchanged entries.


No Responses to “Ignoring versioned files with GIT”  

  1. No Comments

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



Calendar

December 2013
M T W T F S S
« May   Nov »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:

Archives


Categories

Tag Cloud


Listening