Skip to content

Instantly share code, notes, and snippets.

@kunicmarko20
Last active May 23, 2022 16:40
Show Gist options
  • Save kunicmarko20/2fc675891fd6728d63df0889b4e1dba8 to your computer and use it in GitHub Desktop.
Save kunicmarko20/2fc675891fd6728d63df0889b4e1dba8 to your computer and use it in GitHub Desktop.
Create new branch while providing ticket number and short description
gcf 1111 create-user-managment

This will create a new branch feature/PRJ-1111/create-user-managment

#!/bin/bash
#Change this to your project short name
PROJECT_SHORT_NAME=PRJ
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 feature/"$PROJECT_SHORT_NAME"-"$1"/"$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment