Compholio
Compholio

Reputation: 1012

How do I get "git reset" to also automatically reset submodules?

I'm working on some projects with a number of submodules, so it's nice to be able to reset the submodules when working on the main project. One way to solve this is by adding a flag to the reset to tell it to recurse into the submodules and update them as well:

git reset --hard --recurse-submodules <COMMIT>

It seems like there should be a config option for this flag, but there doesn't appear to be anything in the man page.

Upvotes: 1

Views: 43

Answers (1)

Compholio
Compholio

Reputation: 1012

There is a configuration option described in the online manual that turns on recursion into submodules for a lot of git commands:

git config --global submodule.recurse true

This particular option has a lot of knock-on effects, so it's good to be aware of that.

Upvotes: 1

Related Questions