0

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!

chaimp
  • 16,897
  • 16
  • 53
  • 86
  • 2
    It looks like there is an answer here: http://stackoverflow.com/questions/1753070/git-ignore-files-only-locally I will leave the question here, in case anyone else has any other insight though. – chaimp May 18 '16 at 22:30
  • If they are for your specific development environment I would argue that they shouldn't be in your repo. – Jared May 18 '16 at 22:42
  • @Jared There are general config files that have small changes to paths and urls in a few places, specific to my development environment. Ideally these configurations should be set at runtime by env variables, but that's just not how it is. – chaimp May 18 '16 at 22:48
  • 1
    .git/info/exclude? – user3159253 May 18 '16 at 23:47
  • You could also use a hook like `pre-commit` to implement it. But of course it's not so convenient as the exclude or ignore way. Just FYI. But it does work after you have added these files into the git repo. – ElpieKay May 19 '16 at 01:17

1 Answers1

1

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.
user3159253
  • 16,836
  • 3
  • 30
  • 56