How do you tell git to permanently ignore changes in a file?

Posted by Malvineous on Stack Overflow See other posts from Stack Overflow or by Malvineous
Published on 2010-04-20T07:09:43Z Indexed on 2010/04/20 7:13 UTC
Read the original article Hit count: 158

Filed under:

Hi all,

I'm working with a git repository that's storing data for a website. It contains a .htaccess file, with some values that are suitable for the production server. In order for me to work on the site, I have to change some values in the file, but I never want to commit these changes or I will break the server.

Since .gitignore doesn't work for tracked files, I was using "git update-index --assume-unchanged .htaccess" to ignore my changes in the file, however this only works until you switch branches. Once you change back to your original branch, your changes are lost.

Is there some way of telling git to ignore changes in a file and leave it alone when changing branches? (Just as if the file was untracked.)

© Stack Overflow or respective owner

Related posts about git