Quantcast
Channel: NewInstance » Linux
Viewing all articles
Browse latest Browse all 10

Ignoring versioned files with GIT

$
0
0

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.


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images