Skip to content

Instantly share code, notes, and snippets.

@house9
Created October 31, 2012 20:23
Show Gist options
  • Save house9/3989586 to your computer and use it in GitHub Desktop.
Save house9/3989586 to your computer and use it in GitHub Desktop.
build and execute multiple git commands
### matches all git tags that start with numeric value, update regex as needed
# commands to remove local tags
git tag -l | grep "^\d" | sed 's/^/tag -d /' > _remove_tags
# commands to remove remote tags
git tag -l | grep "^\d" | sed 's/^/push origin :refs\/tags\//' > _remove_tags_remote
# review contents of file
cat _remove_tags | while read line; do echo $line; done
# execute each line in file
cat _remove_tags | while read line; do git $line; done
# review contents of file
cat _remove_tags_remote | while read line; do echo $line; done
# execute each line in file
cat _remove_tags_remote | while read line; do git $line; done
@quanturium
Copy link

git tag -l | grep "^\d" | sed 's/^/git push origin :/' | sh
git tag -l | grep "^\d" | sed 's/^/git tag -d /' | sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment