Created
June 4, 2019 14:06
-
-
Save relwell/100673dc7a31016d5d893821e9e86bb6 to your computer and use it in GitHub Desktop.
Git Branching with Trello
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 -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