Skip to content

Instantly share code, notes, and snippets.

@hamsterbacke23
Created January 28, 2016 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamsterbacke23/1168cd9fb762a6970491 to your computer and use it in GitHub Desktop.
Save hamsterbacke23/1168cd9fb762a6970491 to your computer and use it in GitHub Desktop.
updateMain.sh
#/bin/bash
# how many tags back will we search
tagCount=$1
if [ -z "$1" ]
then
tagCount=2
fi
previousAndCurrentGitTag=$(git for-each-ref --format="%(refname:short)" refs/tags | tac | sed $(echo $tagCount)q | sed 's/[()]//g' | sed s/,[^,]*$//)
previousGitTag=$(echo $previousAndCurrentGitTag | cut -f $tagCount -d ' ')
currentGitTag=$(echo $previousAndCurrentGitTag | cut -f 1 -d ' ')
echo $previousGitTag
echo 'to'
echo $currentGitTag
cd /srv/www/dir && git pull && grunt deploy --tagstart=$previousGitTag --tagend=$currentGitTag
cd -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment