Git ignore local changes to portions of tracked files

Solution 1:

Try using this command:

git update-index --assume-unchanged FILENAME_TO_IGNORE

To reverse it (if you ever want to commit changes to it), use:

git update-index --no-assume-unchanged

UPDATE:

Here's how to list 'assume unchanged' files under current directory:

git ls-files -v | grep -E "^[a-z]"

As the -v option will use lowercase letters for 'assume unchanged' files.

Solution 2:

I don't believe there's a specific command that will 'untrack' certain changes to a file. However, there's no reason that you couldn't create a local branch into which you pull changes from your remotes, but never send any changes back.