Created
January 25, 2012 11:57
-
-
Save Andrew8xx8/1675947 to your computer and use it in GitHub Desktop.
Git push like a real man
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 | |
USAGE="Usage: -b branch name" | |
while getopts b: options; do | |
case $options in | |
b ) BRANCH="$OPTARG";; | |
esac | |
done | |
if [ $# -eq 0 ]; then | |
echo $USAGE | |
exit | |
fi | |
echo " -=========================" | |
echo "-== Stach local changes -==" | |
git stash | |
echo "" | |
echo " -=========================" | |
echo "-== Fetch changes -==" | |
git fetch | |
echo "" | |
echo " -=========================" | |
echo "-== Try to rebase -==" | |
git rebase origin/$BRANCH | |
echo "" | |
echo " -=========================" | |
echo "-== PUSH IT! -==" | |
git push origin $BRANCH:$BRANCH | |
echo "" | |
echo " -=========================" | |
echo "-== Apply stash -==" | |
git stash apply | |
echo "" | |
echo 'Fuck Yeah!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment