Ignore modified (but not committed) files in git?

John Doe picture John Doe · Mar 17, 2009 · Viewed 72.4k times · Source

Can I tell git to ignore files that are modified (deleted) but should not be committed?

The situation is that I have a subdirectory in the repo which contains stuff I'm not interested in at all, so I deleted it to prevent it showing up in auto-completions and the like (in the IDE).

But now, if I add that folder to .gitignore, simply nothing changes, all the stuff is shown as deleted by git status.

Is there a way to make git ignore it either way?

(Alternatively, as I'm using git-svn, could I commit the changes to the local git and ensure they are not passed on to the svn repo?)

Answer

csmosx picture csmosx · Apr 17, 2009

check out the git-update-index man page and the --assume-unchanged bit and related.

when I have your problem I do this

git update-index --assume-unchanged dir-im-removing/

or a specific file

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