Skip to content

Instantly share code, notes, and snippets.

@rud
Forked from reinh/hack.sh
Created May 4, 2009 19:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rud/106620 to your computer and use it in GitHub Desktop.
Save rud/106620 to your computer and use it in GitHub Desktop.
#!/bin/sh -x
# Exit if any error is encountered:
set -o errexit
# git name-rev is fail
CURRENT=`git branch | grep '\*' | awk '{print $2}'`
git checkout master
git pull --rebase origin master
git checkout ${CURRENT}
git rebase master
@joefiorini
Copy link

You can use set -e at the top of your script and clean up the || exit 1s at the end of each line.

@rud
Copy link
Author

rud commented Feb 22, 2011

Hi joefiorini,

Thank you for the tip, I've updated the gist as suggested. Much cleaner that way. Aah, proper error handling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment