Created
May 22, 2012 23:41
-
-
Save lachie/2772382 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
# gup and friends | |
function git_current_branch() { | |
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///' | |
} | |
alias grb='git rebase -p' | |
alias gup_base='git fetch origin && grb origin/$(git_current_branch)' | |
function gup() { | |
if ! git diff-index --quiet HEAD; then | |
echo your index is dirty | |
echo please git stash or commit, then rerun gup | |
else | |
gup_base | |
fi | |
} | |
# git reset hard - gup | |
function guph() { | |
if ! git diff-index --quiet HEAD; then | |
echo your index is dirty | |
echo pressing enter blows your changes away | |
echo ctrl-c to back out | |
read | |
fi | |
git reset --hard HEAD | |
gup_base | |
} | |
# stash - gup - stash pop | |
function gups() { | |
local stashed | |
stashed=$(git stash) | |
gup_base | |
if [[ $stashed != "No local changes to save" ]] | |
then | |
git stash pop | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment