djondal djondal - 3 months ago 15
Git Question

With git, temporary exclude a changed tracked file from commit in command line

I have a tracked database (already added) file in git. I want this file to always contain the same data in my git repository. Even when I modify it in the working copy (local sandbox) for test purposes.

With git, how to exclude this changed file on my working copy from a commit ?

Answer

The way to ignore certain files that are already committed is

git update-index --assume-unchanged file

However, this is a local setting, and it doesn't propagate when cloning.

Its effect is canceled with git update-index --no-assume-unchanged gui.