Skip to content

Instantly share code, notes, and snippets.

@mahdavipanah
Created December 6, 2018 10:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahdavipanah/e68e0a34bf5929c5ba2330dbae389311 to your computer and use it in GitHub Desktop.
Save mahdavipanah/e68e0a34bf5929c5ba2330dbae389311 to your computer and use it in GitHub Desktop.
Zsh function for git checkout and create a branch
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