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!

5
  • 2
    It looks like there is an answer here: stackoverflow.com/questions/1753070/… I will leave the question here, in case anyone else has any other insight though. Commented May 18, 2016 at 22:30
  • If they are for your specific development environment I would argue that they shouldn't be in your repo. Commented May 18, 2016 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. Commented May 18, 2016 at 22:48
  • 1
    .git/info/exclude? Commented May 18, 2016 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. Commented May 19, 2016 at 1:17

1 Answer 1

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.
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.