Interview Prep/Git & GitHub/Submodules, LFS and Hooks

`git submodule update --remote` fails with `fatal: Unable to find current origin/master revision in submodule path 'libs/common'`.

AdvancedTroubleshootingSubmodules, LFS and Hooks
Answer

Likely causes → --remote tracks the branch in .gitmodules (submodule.<name>.branch), and without one older behavior assumes master. The submodule repo renamed its default branch to main, so origin/master no longer exists.

Diagnose →

git config -f .gitmodules --get-regexp 'submodule\..*\.branch'
git -C libs/common ls-remote --symref origin HEAD

Fix → Point it at the right branch (or . to follow the parent's branch name):

git submodule set-branch --branch main libs/common
git submodule sync --recursive
git submodule update --remote libs/common
git add .gitmodules libs/common && git commit -m "Track main in common"

Prevent → Always set branch = main explicitly in .gitmodules for submodules that use --remote.

All Git & GitHub questions Roadmap: Git & GitHub

More on Submodules, LFS and Hooks