Created
August 26, 2017 07:01
-
-
Save takezoe/a48e987b6ebce2969a9c9cd96521c184 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function peco-git-checkout() { | |
| local BRANCH=`git branch -a | peco` | |
| if [[ -z "$BRANCH" ]]; then | |
| return | |
| fi | |
| if [[ "$BRANCH" =~ remotes/([^/]*)/(.*) ]]; then | |
| git checkout -b ${BASH_REMATCH[2]} ${BASH_REMATCH[1]}/${BASH_REMATCH[2]} | |
| else | |
| git checkout $BRANCH | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment