Skip to content

Instantly share code, notes, and snippets.

@MahmoudDolah
Created October 26, 2018 19:34
Show Gist options
  • Save MahmoudDolah/c378b5d26b41e02ed372b7ec7af59714 to your computer and use it in GitHub Desktop.
Save MahmoudDolah/c378b5d26b41e02ed372b7ec7af59714 to your computer and use it in GitHub Desktop.
Shell function to fuzzy search your branches (insert this into your bashrc / zshrc)
function fbr() {
git fetch
local branches branch
branches=$(git branch -a) &&
branch=$(echo "$branches" | fzf +s +m -e) &&
git checkout $(echo "$branch" | sed "s:.* remotes/origin/::" | sed "s:.* ::")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment