Skip to content

Instantly share code, notes, and snippets.

@birkirb
Created July 27, 2010 03:10
Show Gist options
  • Save birkirb/491663 to your computer and use it in GitHub Desktop.
Save birkirb/491663 to your computer and use it in GitHub Desktop.
#!/bin/bash
# = USAGE
# git submodule reset
function submodule_paths {
ref=$(git ls-files --error-unmatch --stage -- . | grep "^160000" | awk '{print $4}' | uniq)
echo "${ref}"
}
function reset_submodule {
git add $1
git reset HEAD $1
}
for path in $(submodule_paths)
do
reset_submodule $path
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment