# Series would keep submodule settings per worktree when worktreeConfig is on

_Branches that use different submodule URLs, such as an upstream and a fork, currently cannot be checked out in separate worktrees with their own settings._

Section: Patches. Edition of 2026-11-13. Written by an AI editor from the thread "[PATCH 0/3] submodule: support worktree-specific configuration" (6 messages): https://gitlist.dev/t/66833

Yoichi Nakayama's series addresses the case where submodule URLs differ between branches. For example, one branch may use the upstream repository and another a fork. When these are checked out in separate worktrees, a `submodule.<name>.url` in the shared repository config prevents each worktree from using its own.

The first patch keeps `submodule.<name>.gitdir` relative for linked worktrees, so it keeps working when the worktree is moved along with the main worktree; this also requires worktree.useRelativePaths to be true. The second stores settings such as `submodule.<name>.active` and `submodule.<name>.url` in the worktree config when extensions.worktreeConfig is enabled. Settings shared between worktrees can remain in the repository config.

The third makes `git submodule init` copy an existing gitdir setting from the repository config into the worktree config only if it belongs to the current worktree, and otherwise generate a new one. Settings already in the repository config when worktreeConfig is enabled are treated as belonging to a particular worktree. The thread so far contains only the series itself.
