Created
January 13, 2022 00:24
-
-
Save justinbarry/c55b8aee285644426c68d2e634d1a980 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
#!/bin/bash | |
((!$#)) && echo No issue number provided, command ignored! && exit 1; | |
TITLE=$(gh issue view $1 --json title | jq --raw-output '.title' ) | |
ESCAPED_TITLE=$(echo "GH-$1-${TITLE// /-}" | tr -cd '[:alnum:][\-]' | cut -c1-100); | |
if [ `git branch --list $ESCAPED_TITLE` ]; then | |
git checkout $ESCAPED_TITLE; | |
else | |
git checkout dev; | |
git pull origin --rebase; | |
git checkout -b $ESCAPED_TITLE; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment