chaimp
chaimp

Reputation: 17907

How to tell git to ignore changes in certain files, but not to put them in .gitignore?

I have some files that are part of a project that have some minor modifications from their source in the repository to control settings specific to my development environment.

They are constantly listed as "modified" and are always left unstaged.

These files do not belong in a .gitignore, as far as I am aware, since they belong in the repository. I would like git to basically ignore the fact that they have been modified.

This must be a common scenario, and I am looking for the best-practice way to handle it.

Thanks!

Upvotes: 0

Views: 298

Answers (1)

user3159253
user3159253

Reputation: 17455

Check git ignoring documentation.

Generally, you have three options:

  1. a global ignore file, specified in the global core.excludesfile setting.
  2. a per-repository .git/info/exclude, not shared with other repo instances (and thus, other team members)
  3. a regular .gitignore in a given location of the source tree.

Upvotes: 1

Related Questions