Home > git > Ignore Git files that already exist in the repository

Ignore Git files that already exist in the repository


I made changes to some config files for dev purposes. And I didn’t want to commit that back into git. The problem is that .gitignore and .git/info/exclude don’t work on a file already in the repository. So after googling a bit, I found a way to do this here: http://justaddwater.dk/2009/12/07/how-to-make-git-ignore-files-that-already-exist-in-your-project/

And here’s the command from that link:

git update-index --assume-unchanged config/database.yml

Of course you won’t be able to update that file until you do:

git update-index --no-assume-unchanged config/database.yml

The doc on this command is here: http://www.kernel.org/pub/software/scm/git/docs/git-update-index.html

Advertisements
Categories: git Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: