1

If I add a filename to gitignore, this will be ignored by git and will not go in the repository. What I would like to do is to have a specific file in the upstream repository, allow everybody to check it out and modify it according to their needs, but then exclude it from their commits.

Basically I would like the repository to provide a template configuration file that needs to be fine tuned depending on the development environment of each developer, but that must not be modified in the repository.

Pietro
  • 12,086
  • 26
  • 100
  • 193
  • 3
    The way this is usually done is by having the actual file ignored and providing a sample file (e.g. `.env.sample`, `config.json.sample`,etc) which people have to copy to their local versions. – CherryDT Oct 07 '21 at 15:07
  • Have you tried committing the file to the repo before you add commit the `.gitignore`. To my knowledge this will add the file to the repository, but make it be ignored if there are changes made in local repos in the future. – Jonathon S. Oct 07 '21 at 15:16

0 Answers0