diff --git a/Examples-(fish).md b/Examples-(fish).md index f58da31..8435e1c 100644 --- a/Examples-(fish).md +++ b/Examples-(fish).md @@ -113,11 +113,14 @@ end function snag -d "Pick desired files from a chosen branch" # use fzf to choose source branch to snag files FROM - set branch (git for-each-ref --format='%(refname:short)' refs/heads | fzf --height 10% --layout=reverse --border) - # use fzf to choose files that differ from current branch - set files (git diff --name-only $branch | fzf --height 10% --layout=reverse --border --multi) + set branch (git for-each-ref --format='%(refname:short)' refs/heads | fzf --height 20% --layout=reverse --border) + # avoid doing work if branch isn't set + if test -n "$branch" + # use fzf to choose files that differ from current branch + set files (git diff --name-only $branch | fzf --height 20% --layout=reverse --border --multi) + end # avoid checking out branch if files aren't specified - if set -q files + if test -n "$files" git checkout $branch $files end end