Skip to content

Instantly share code, notes, and snippets.

@pombredanne
Last active August 29, 2015 14:06
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save pombredanne/6a1260da304ecc51625d to your computer and use it in GitHub Desktop.
Checkout a git tag with deeply nested submodules
# get a tag
git checkout --force tags/mytag
# from then on I am in a detached head state
# then sync all submodule to point to the correct rev and force cleaning untracked dir and files
git submodule foreach --recursive 'git submodule sync; git clean -ffd'
# force update to get all submodule content
git submodule update --init --recursive --force
# clean again, forcing untracked file and dir deletion
git clean -ffd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment