`gh repo sync` does not update submodules in local repo
Author: muzimuzhiCreated Jul 20, 2026Updated Sep 16, 2026
Labelsenhancementgh-repostale
Describe the bug
When local repo is used as the destination repo, gh repo sync does not update submodules. --recurse-submodules
Same issue in other gh subcommands:
- Both
gh repo cloneandgh repo forksupports passing additional Git flags after--. gh pr checkoutsupports flag--recurse-submodules.
Affected version
gh version 2.96.0 (2026-07-02) https://github.com/cli/cli/releases/tag/v2.96.0
Steps to reproduce the behavior
Using https://github.com/Witiko/expltools as an example. It sets two submodules.
# preparations
$ git clone --revision=a13cc24554adf90e3a6f4a82a8b8528cadb2f412 --depth=1 [email protected]:Witiko/expltools.git
$ cd expltools
$ git switch -c main
$ git submodule update --init --recursive --depth=1
$ gh repo sync --branch main
✓ Synced the "main" branch from "Witiko/expltools" to local repository
$ git status
On branch main
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: third-party/latex3 (new commits)
no changes added to commit (use "git add" and/or "git commit -a")
Expected vs actual behavior
Expected: gh repo sync updates submodules and leaves a clean working tree, either automatically or by passing some extra (Git) flag.
Actual: If the sync-ed commits contains submodule updates, gh repo sync leaves submodule directori(es) dirty, see the git status output shown above.
Source: cli/cli