# put this in your .bashrc function switch() { git branch | grep "$1" | pbcopy && tmp=$(pbpaste) && git checkout $tmp } # example branch ... 8038031-update-things-long-branch-name-of-things # use in the CLI # $ switch 38031 (or any unique searchable string)