The first patch teaches checkout/reset (with --recurse-submodules) to unset the core.worktree config when the new state of the superprojects working tree doesn't contain the submodules working tree. The last patch is teaching "git submodule deinit" to unset the core.worktree setting as well. It turned out this one is tricky, as for that we also have to set it in the counter part, such as "submodule update". Thanks, Stefan Stefan Beller (3): submodule: unset core.worktree if no working tree is present submodule: ensure core.worktree is set after update submodule deinit: unset core.worktree builtin/submodule--helper.c | 26 ++++++++++++++++++++++++++ git-submodule.sh | 5 +++++ submodule.c | 14 ++++++++++++++ submodule.h | 2 ++ t/lib-submodule-update.sh | 5 +++-- t/t7400-submodule-basic.sh | 5 +++++ 6 files changed, 55 insertions(+), 2 deletions(-) -- 2.18.0.rc1.244.gcf134e6275-goog