Reputation: 4545
I think that the answer to this question is probably that it can't be done but I would be interested to hear any solutions or workarounds that people use.
The situation is that I have a seed npm project. Whenever my team wants to start a new project they clone this project and use it as a basis for the new work.
In this seed project when I do npm install
I get a package-lock.json
file. I do not want to check this file in as I do not want to lock projects that are based on the seed project to the dependency versions of the seed project.
However, I do not want to add this file to the .gitignore
file as if I do that the .gitignore
file would also be copied and then the lock file would also be ignored in the project that is based on the seed.
I hope that I have explained that well enough.
Upvotes: 3
Views: 80
Reputation: 45819
You can create local ignore rules that are not shared as part of the repository content. Of course each clone that needs the rule has to be configured individually, but for your use case that's probably a good trade-off.
The file .git/info/exlcude
works just like .gitignore
but is loacl.
Upvotes: 3