Created
March 11, 2015 20:41
-
-
Save ischneider/a4b87216ff36f2e9acb0 to your computer and use it in GitHub Desktop.
latest submodule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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