Git ignore deleted files

Petah picture Petah · Apr 27, 2010 · Viewed 15.4k times · Source

I have a website project that has more than 50,000 unimportant files (to development) in some directories.

/website.com/files/1.txt
/website.com/files/2.txt
/website.com/files/3.txt
/website.com/files/etc.txt

The stuff in /files is already in the repo. I want to delete all the files in /files on my local copy but I want git to ignore it so it doesn't delete them when I do a pull on the web server.

Any ideas?

Answer

dave1010 picture dave1010 · Jul 28, 2011

Ignoring a whole directory didn't work. I had to do this:

for i in `git status | grep deleted | awk '{print $3}'`; do git update-index --assume-unchanged $i; done