-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
37 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,26 @@ | ||
#!/bin/bash | ||
|
||
TAG="${1:-v1.0.0}" | ||
# Ensure two arguments are provided (OLD_TAG and NEW_TAG). | ||
if [ $# -lt 2 ]; then | ||
echo "Error: Missing arguments." | ||
echo "Usage: $0 <OLD_TAG> <NEW_TAG>" | ||
echo "Example: ./retag.sh v1.1.0 v1.1.0" to replace the tag! | ||
exit 1 | ||
fi | ||
|
||
echo "Removing local tag: $TAG" | ||
git tag -d "$TAG" 2>/dev/null | ||
OLD_TAG="$1" | ||
NEW_TAG="$2" | ||
|
||
echo "Removing remote tag: $TAG" | ||
git push origin ":refs/tags/$TAG" | ||
echo "Removing old local tag (if exists): $OLD_TAG" | ||
git tag -d "$OLD_TAG" 2>/dev/null | ||
|
||
echo "Creating local tag: $TAG" | ||
git tag "$TAG" | ||
echo "Removing old remote tag (if exists): $OLD_TAG" | ||
git push origin ":refs/tags/$OLD_TAG" 2>/dev/null | ||
|
||
echo "Pushing tag: $TAG" | ||
git push origin "$TAG" | ||
echo "Creating new local tag: $NEW_TAG" | ||
git tag "$NEW_TAG" | ||
|
||
echo "Done! The tag '$TAG' has been recreated and pushed." | ||
echo "Pushing new tag to remote: $NEW_TAG" | ||
git push origin "$NEW_TAG" | ||
|
||
echo "Done! '$OLD_TAG' (if it existed) was removed, and '$NEW_TAG' has been created and pushed." |