Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save StephenHodgson/5a4a6cfce9c838afcb05c52932abb03b to your computer and use it in GitHub Desktop.
Save StephenHodgson/5a4a6cfce9c838afcb05c52932abb03b to your computer and use it in GitHub Desktop.
Recursively checks out all submodule branches instead of being in a detached head
#!/bin/bash
git submodule foreach -q --recursive 'echo $name && git switch -C $(git name-rev --exclude=refs/tags/\* --name-only $(git rev-parse @{-1}))'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment