Ignore a single file in a GIT repository that is checked in but changes a lot (and you don't want to keep those changes)

Purpose

You have a repository in GIT. For some reason, your project produces artifacts that change all the time, for instance

  • A filename is injected into them (Stupid Entity Framework EDMX changes) and this filename changes depending on who runs it
  • A filename that continually gets injected with different line endings
  • Any other reason

If you would just like to ignore it then you can try the following

git update-index --skip-worktree .\YourFileToIgnore.txt
Command line to ignore a file

And then if you change your mind use

git update-index --no-skip-worktree .\YourFileToIgnore.txt
Command line to stop ignoring a file

to reverse it.