Created
July 8, 2011 15:04
-
-
Save afternoon/1072034 to your computer and use it in GitHub Desktop.
Sync with a git remote, using git-up if available, pull --rebase if not
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/sh | |
changed=`git status -s | wc -l` | |
if [[ "$changed" -gt "0" ]]; then | |
echo "\033[31mCan't sync: working tree dirty\033[0m" | |
else | |
repo=${1:-origin} | |
if which -s git-up; then | |
git up $repo | |
else | |
git pull --rebase $repo | |
fi | |
git push $repo | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment