Skip to content

Instantly share code, notes, and snippets.

@Andrew8xx8
Created January 25, 2012 11:57
Show Gist options
  • Save Andrew8xx8/1675947 to your computer and use it in GitHub Desktop.
Save Andrew8xx8/1675947 to your computer and use it in GitHub Desktop.
Git push like a real man
#!/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