Created
November 4, 2015 21:21
-
-
Save yoichi/a9626fc4ccc2446c6f14 to your computer and use it in GitHub Desktop.
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 | |
BRANCH=$(git rev-parse --abbrev-ref HEAD) | |
REMOTE=$(git config --get branch.${BRANCH}.remote) | |
if [ -z ${REMOTE} ]; then | |
echo "no remote" | |
exit -1 | |
fi | |
git fetch | |
if [ $? != 0 ]; then | |
echo "fetch failed" | |
exit -1 | |
fi | |
git reset --hard ${REMOTE}/${BRANCH} | |
if [ $? != 0 ]; then | |
echo "reset failed" | |
exit -1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment