Created
June 6, 2014 00:36
-
-
Save leafo/17028b742ed32a3fa384 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
function _annotate() { | |
echo "$(tput setaf 4)>>$(tput sgr0) $@" | |
eval $@ | |
} | |
function gup() { | |
branch=$([[ -n "$1" ]] && echo "$1" || git rev-parse --abbrev-ref HEAD) | |
dirty=$(git diff --shortstat 2> /dev/null | tail -n1) | |
_annotate git fetch || return | |
[[ -n "$dirty" ]] && (_annotate git stash || return) | |
_annotate git rebase "origin/$branch" || return | |
[[ -n "$dirty" ]] && (_annotate git stash pop || return) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment