Skip to content

Instantly share code, notes, and snippets.

@ykhs
Created February 28, 2016 18:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ykhs/fd4ebe7c06b62fcb5ab5 to your computer and use it in GitHub Desktop.
Save ykhs/fd4ebe7c06b62fcb5ab5 to your computer and use it in GitHub Desktop.
function peco_select_branch
set -l query (commandline)
if test -n $query
set peco_flags --query "$query"
end
git branch | peco --prompt "GIT BRANCH>" $peco_flags | sed -e "s/^\* //g" -e "s/^ //g" | read line
if [ $line ]
git checkout $line
commandline -f repaint
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment