Created
December 6, 2018 10:13
-
-
Save mahdavipanah/e68e0a34bf5929c5ba2330dbae389311 to your computer and use it in GitHub Desktop.
Zsh function for git checkout and create a branch
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 gsc() { | |
git branch | grep -w "$1" > /dev/null; | |
if [ $? = 0 ]; then | |
git checkout "$1"; | |
else | |
git checkout -b "$1"; | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment