Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to add/initiate a new git submodule with the ignore option set to a certain value?

I have a script that sets up a project for me and my co-workers. We are using git submodules inside our repository. The script I've made creates untracked config files inside the submodules' directories (cabal's sandbox config files to be more specific). I'm never going to modify the submodules, will never push any changes. I would like for those config files not to be listed as modifications to the repository, so I ignore them with the submodule option ignore = untracked. However, I have to do that manually for each submodule entry in the .git/config file.

The question at hand: is it possible to set that option per submodule when calling git submodule add or git submodule init? If not, is there any git command that would allow me to set such a config variable per-module after initialisation?

like image 575
Konrad Madej Avatar asked Oct 20 '22 05:10

Konrad Madej


1 Answers

According to the docs there is no such option available for the add and init subcommands.

However there is a git config command that allows setting that config option per submodule:

git config submodule.full/submodule-name.ignore untracked

like image 151
Konrad Madej Avatar answered Oct 24 '22 12:10

Konrad Madej