Created
October 23, 2014 15:29
-
-
Save jeremytregunna/d1660f5239600b342d22 to your computer and use it in GitHub Desktop.
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/zsh | |
if [ X"$1" = X"-h" ]; then | |
echo "Usage: git grab [remote]" | |
echo " Fetches changes from the supplied remote, or origin if omitted and rebases changes" | |
echo " onto your branch." | |
exit 0 | |
fi | |
REMOTE=$1 | |
[ -z ${REMOTE} ] && REMOTE="origin" | |
function git_current_branch() { | |
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///' | |
} | |
git fetch ${REMOTE} && git rebase -p ${REMOTE}/$(git_current_branch) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment