Skip to content

Instantly share code, notes, and snippets.

@paultyng
Created December 15, 2016 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save paultyng/28c915d6d4a7b4453828c21cbc748028 to your computer and use it in GitHub Desktop.
Save paultyng/28c915d6d4a7b4453828c21cbc748028 to your computer and use it in GitHub Desktop.
#!/bin/bash
remote="${1:-origin}"
echo "Using remote $remote"
branches="$(git ls-remote --heads $remote | awk '{print $2}' | awk -F'/' '{print $3}' | grep '^v' | sort | uniq)"
echo "$branches" | while read branch; do
echo "Branch: $branch"
git checkout "$remote/$branch"
git tag -f -a "$branch" -m "$branch"
done
git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment