Created
November 13, 2023 13:33
-
-
Save BobToninho/854f111378b823cec537ecd0e68b1acf to your computer and use it in GitHub Desktop.
This file contains 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 gch { | |
BRANCH=$(git branch | fzf --cycle | tr -d '[:space:]') | |
if [[ $BRANCH =~ '^\*' ]] then | |
echo "current branch selected, nothing to do" | |
return 0 | |
fi | |
if [[ -n $BRANCH ]] then | |
git checkout $BRANCH | |
else | |
echo "no branch seleted, aborting" | |
return 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment