Skip to content

Instantly share code, notes, and snippets.

@tt
Last active December 22, 2015 07:38
Show Gist options
  • Save tt/6438972 to your computer and use it in GitHub Desktop.
Save tt/6438972 to your computer and use it in GitHub Desktop.
Convert all branches of origin matching `/v[0-9*/` to tags.
branches=`git branch -a | grep 'remotes/origin/v[0-9]*$' | cut -d '/' -f 3`
echo $branches | xargs -I {} git tag {} origin/{}
git push origin --tags
echo $branches | sed 's/^/:refs\/heads\//' | xargs git push origin
git remote prune origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment