3

We have a file in git that we never want to change. This file has default values that the product ships with. However when we run a build process locally, this file gets changed.

So naturally this file gets checked in all the time as people forget and commit it.

And yes, I know this is dumb - but it's difficult to change this behavior (don't ask)....

Is there a way to mark this file at a repo level so that it never shows as changed in git status? It's fine if the version in the repo gets checked out and the local copy is overwritten.

thoguhts?

thanks

phil swenson
  • 8,564
  • 20
  • 74
  • 99

1 Answers1

2

You can try, from the command git update-index:

git update-index --skip-worktree -- path

--[no-]skip-worktree

When one of these flags is specified, the object name recorded for the paths are not updated.
Instead, these options set and unset the "skip-worktree" bit for the paths.

Skip-worktree bit can be defined in one (long) sentence:
When reading an entry, if it is marked as skip-worktree, then Git pretends its working directory version is up to date and read the index version instead.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • this would have to be run on every developer's machine, right? I think this mostly solves the problem, but the ideal is a setting at a repo level. – phil swenson Aug 31 '13 at 19:46
  • @philswenson then at the repo level, you have the content filter driver, but it is trickier: http://stackoverflow.com/a/4287968/6309 – VonC Aug 31 '13 at 19:48