Skip to content

Commit

Permalink
refactor: reorder fetch and stash commands on move option
Browse files Browse the repository at this point in the history
  • Loading branch information
joseluisq committed Jun 23, 2020
1 parent 15a639b commit 3e30e58
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions conf.d/gitnow.fish
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ function move -d "GitNow: Switch from current branch to another but stashing unc
set v_upstream $v
case -n --no-apply-stash
set v_no_apply_stash $v
case -nu -un
set v_upstream "-u"
set v_no_apply_stash "-n"
case '*'
set v_branch $v
end
Expand All @@ -220,6 +223,10 @@ function move -d "GitNow: Switch from current branch to another but stashing unc
return
end

if test -n "$v_upstream"
command git fetch (__gitnow_current_remote) $v_branch
end

set -l v_found (__gitnow_check_if_branch_exist $v_branch)

# Branch was not found
Expand All @@ -239,11 +246,6 @@ function move -d "GitNow: Switch from current branch to another but stashing unc
end

command git stash

if test -n "$v_upstream"
command git fetch (__gitnow_current_remote) $v_branch
end

command git checkout $v_branch

# --no-apply-stash
Expand Down

0 comments on commit 3e30e58

Please sign in to comment.