Skip to content

Instantly share code, notes, and snippets.

@mletterle
Last active December 27, 2015 14:39
Show Gist options
  • Save mletterle/7342157 to your computer and use it in GitHub Desktop.
Save mletterle/7342157 to your computer and use it in GitHub Desktop.
Handy little hook I think...
#!/bin/bash
branchname=`git symbolic-ref -q --short HEAD`
if [[ $branchname =~ 'tfs-.*' ]]; then
workitems=$(echo $branchname | sed s/tfs-//g | tr ',' ' ' )
for workitem in $workitems;
do
cp $1 $1.old
$(sed '1s/^/#git-tfs-work-item: '$workitem' associate\n/' $1.old > $1)
let i++
done
cp $1 $1.old
$(sed '1s/^/\n\n#Automatic Git-TFS Associations\n/' $1.old > $1)
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment