Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set a Git config recursively for all submodules

Tags:

git

git-config

I need to run the command:

git config core.filemode false

The problem is that I have a few projects with at least ten submodules each. For some reason, all the submodules have that value set to true so I would have to remove/update that config manually.

Is there a way to tell Git to set a config value to all submodules?

Or remove it from the submodules so that the containing repo's settings are not overwritten?

like image 434
iosifv Avatar asked Sep 08 '15 09:09

iosifv


1 Answers

You can use the git submodule foreach command for this: https://www.kernel.org/pub/software/scm/git/docs/v1.6.1.3/git-submodule.html

You can provide an arbitrary shell command as a parameter, in your case something like this:

git submodule foreach --recursive git config core.filemode false

This will execute git config core.filemode false in each of the submodules of the current Git repo.

like image 89
nwinkler Avatar answered Oct 14 '22 06:10

nwinkler