Skip to content

Instantly share code, notes, and snippets.

@dgowrie
Created April 3, 2020 15:23
Show Gist options
  • Save dgowrie/887a5a0b3e58f8c2f65f497d36643d9f to your computer and use it in GitHub Desktop.
Save dgowrie/887a5a0b3e58f8c2f65f497d36643d9f to your computer and use it in GitHub Desktop.
git fuzzy find branch
fbr () {
local branches branch
branches=$(git branch --all --sort=-committerdate | grep -v HEAD) && branch=$(echo "$branches" |
fzf-tmux -d $(( 2 + $(wc -l <<< "$branches") )) +m) && git checkout $(echo "$branch" | sed "s/.* //" | sed "s#remotes/[^/]*/##")
}
@dgowrie
Copy link
Author

dgowrie commented Apr 3, 2020

basically lists all recent branches, like yours, but including remotes. You can fuzzy-find through the branches, and when you select one it checks it out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment