only pop the stash if we pushed something
This commit is contained in:
parent
101d23f71f
commit
b180637a19
1 changed files with 7 additions and 1 deletions
|
|
@ -240,7 +240,13 @@ fi
|
||||||
function gup() {
|
function gup() {
|
||||||
BRANCH=$(git branch --no-color --list | grep '^\*' | awk '{print $2}')
|
BRANCH=$(git branch --no-color --list | grep '^\*' | awk '{print $2}')
|
||||||
if [[ "$BRANCH" != "(detached" ]]; then
|
if [[ "$BRANCH" != "(detached" ]]; then
|
||||||
git stash && git fetch origin && git rebase "origin/$BRANCH" && git stash pop
|
STASH_OUTPUT=$(git stash)
|
||||||
|
if [[ "$STASH_OUTPUT" = "No local changes to save" ]]; then
|
||||||
|
POP_STASH=0
|
||||||
|
else
|
||||||
|
POP_STASH=1
|
||||||
|
fi
|
||||||
|
git fetch origin && git rebase "origin/$BRANCH" && ([[ $POP_STASH -eq 1 ]] && git stash pop) || true
|
||||||
else
|
else
|
||||||
echo "Cannot update in a detached HEAD state"
|
echo "Cannot update in a detached HEAD state"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue