Skip to content

Instantly share code, notes, and snippets.

@ischneider
Created March 11, 2015 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ischneider/a4b87216ff36f2e9acb0 to your computer and use it in GitHub Desktop.
Save ischneider/a4b87216ff36f2e9acb0 to your computer and use it in GitHub Desktop.
latest submodule
#!/bin/bash
REPO=$1
function die() {
echo $1
exit 1
}
[ ! -e $REPO/.git ] && die "not git repo"
pushd $REPO
git fetch
LATEST=$(git log -1 --oneline origin/master)
COMMIT=$(echo $LATEST | cut -d ' ' -f 1)
git checkout $COMMIT
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment