Last active
December 27, 2015 19:58
-
-
Save leafo/7380556 to your computer and use it in GitHub Desktop.
gup
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) $@" | |
$@ | |
} | |
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