0

It is possible to track one file, but discard changes to it:

git update-index --assume-unchanged <file>

But this is local setting.

How can I make this visible to my team members, without forcing them to locally do the git update-index --assume-unchanged dance?

volingas
  • 1,023
  • 9
  • 21
  • This smells like an [XY problem](http://mywiki.wooledge.org/XyProblem). What are you _really_ trying to achieve? – Biffen Aug 30 '19 at 09:21
  • Setup a server hook like `pre-receive`. It rejects a push if the push contains new commits that change the file. Or setup a local hook like `pre-commit` which runs `git reset ` to exclude the file. – ElpieKay Aug 30 '19 at 09:25
  • Possible duplicate of [Ignoring server config files in git](https://stackoverflow.com/questions/37966898/ignoring-server-config-files-in-git) – phd Aug 30 '19 at 13:55
  • https://stackoverflow.com/search?q=%5Bgit%5D+track+config+file+ignore+changes – phd Aug 30 '19 at 13:55
  • https://stackoverflow.com/questions/28817040/ignore-configs-with-git – phd Aug 30 '19 at 13:55

1 Answers1

0

The answer is that you can't. Git doesn't support doing this and using git update-index --assume-unchanged for this purpose is not a supported use of that feature.

If you have a config file or other file that needs to change depending on the user or system, then check in a template and generate it as part of a local build step. For example, GitHub uses templating and a set of scripts to set up local configuration in a project-independent way.

bk2204
  • 64,793
  • 6
  • 84
  • 100