Created
July 26, 2013 19:49
-
-
Save Iristyle/6091736 to your computer and use it in GitHub Desktop.
For use during a PR sent to Janky to ensure latest code is pulled
This file contains hidden or 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
if [[ ! -d './.git' ]]; then | |
git init | |
fi | |
owner=$(echo $JANKY_COMMIT_URL | sed -rn 's/^http(s)?\:\/\/github\.com\/(.*?)\/(.*?)\/?/\2/p') | |
repo=$(echo $JANKY_COMMIT_URL | sed -rn 's/^http(s)?\:\/\/github\.com\/(.*?)\/(.*?)\/?/\3/p') | |
url="https://[email protected]/$owner/$repo" | |
found=$(git remote | grep $owner) | |
if [[ -z $found ]]; then | |
echo "Adding remote $owner url as $url" | |
git remote add $owner $url | |
else | |
echo "Setting remote $owner url to $url" | |
git remote set-url $owner $url | |
fi | |
git fetch -v $owner | |
git reset --hard $JANKY_SHA1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment