Skip to content

Instantly share code, notes, and snippets.

@kunicmarko20
Last active February 6, 2023 10:24
Show Gist options
  • Save kunicmarko20/8c0e2a5c752f5ae78576094bf496b7b9 to your computer and use it in GitHub Desktop.
Save kunicmarko20/8c0e2a5c752f5ae78576094bf496b7b9 to your computer and use it in GitHub Desktop.
Create new branch while providing ticket number and short description
gct 1111 create-user-managment

This will create a new branch ticket/PROJECT-1111-create-user-managment.

#!/bin/bash
#Change this to your project ticket prefix
TICKET_PREFIX=PROJECT
if [ -z "$1" ]
then
echo "Ticket number missing";
exit 1;
fi
re='^[0-9]+$'
if ! [[ "$1" =~ $re ]] ; then
echo "First argument should be a number of the ticket"; exit 1
fi
if [ -z "$2" ]
then
echo "Short description missing";
exit 1;
fi
git checkout -b ticket/"$TICKET_PREFIX"-"$1"-"$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment