1

I have a config file on which I ran:

git update-index --assume-unchanged <name of config file>

It's not being tracked but it's still being updated occasionally. No idea how but it's incredibly frustrating.

Any suggestions how I track down exactly what is causing the issue?

Snowcrash
  • 80,579
  • 89
  • 266
  • 376

1 Answers1

1

git update-index --assume-unchaged mainly intends to avoid issues when your file system has an inefficient lstat(2) implementation. It's main goal is to improve performance; assume-unchanged does not intend to protect the file from upstream changes or hard resets.

What you are truly looking for is git update-index --skip-worktree. While the documentation isn't particular obvious in this regard, the skip-worktree bit should be used when you have files which should be changed locally (as explained in this answer) while avoiding to commit this changes to the repository.

Sadly the names of assume-unchanged and skip-worktree communicate their intent very badly, most of the time skip-worktree is the superior choice and the correct solution.

Community
  • 1
  • 1
Sascha Wolf
  • 18,810
  • 4
  • 51
  • 73
  • is it possible to also prevent safe changes? From the docs: *Note that Git can update working directory file, that is marked skip-worktree, if it is safe to do so.* – user1978011 May 08 '15 at 09:05
  • @user1978011 AFAIK no, it isn't. But if that's what you want, why tracking the file in the first place? Maybe it makes more sense to use a *default file*, and copy it locally. For example if you have an `.env` file your application requires, you could add `.env` to your `.gitignore` while tracking a file named `.env.default` which contains sensible defaults. – Sascha Wolf May 08 '15 at 09:23