Skip to content

Instantly share code, notes, and snippets.

@relwell
Created June 4, 2019 14:06
Show Gist options
  • Save relwell/100673dc7a31016d5d893821e9e86bb6 to your computer and use it in GitHub Desktop.
Save relwell/100673dc7a31016d5d893821e9e86bb6 to your computer and use it in GitHub Desktop.
Git Branching with Trello
#!/bin/bash -e
card_branch_name() {
if [ ! -n "${UT_TEAM}" ]; then
echo "\$UT_TEAM not set!" && return 1;
fi
project=$1
url=$2
if [[ $url = '' ]]; then
url=$project
project=''
fi
if [[ $project != '' ]]; then
project="--${project}"
fi
cardid=`echo $url | cut -d/ -f5`;
description=`echo $url | cut -d/ -f6 | sed -e 's/-$//g' | sed -E 's/^[[:digit:]-]+//g'`;
echo "${UT_TEAM}${project}--${cardid}--${description}";
}
card_branch () {
git checkout -b `card_branch_name $1 $2` master
}
open_branch () {
git checkout `card_branch_name $1 $2`
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment