Skip to content

Commit 5be69fd

Browse files
committed
CHANGE Tag Managers
1 parent c977b44 commit 5be69fd

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

tag_manager.bat

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
:main
5+
set /p tag_name="Enter tag name: "
6+
7+
if "%tag_name%"=="" (
8+
echo Error: Tag name required
9+
exit /b 1
10+
)
11+
12+
git rev-parse --git-dir >nul 2>&1
13+
if errorlevel 1 (
14+
echo Error: Not in a Git repository
15+
exit /b 1
16+
)
17+
18+
git tag -l | findstr /r "^%tag_name%$" >nul 2>&1
19+
if not errorlevel 1 (
20+
echo Tag '%tag_name%' exists. Deleting...
21+
git tag -d "%tag_name%"
22+
23+
git ls-remote --tags origin | findstr /r "refs/tags/%tag_name%$" >nul 2>&1
24+
if not errorlevel 1 (
25+
git push origin --delete "%tag_name%"
26+
)
27+
)
28+
29+
echo Creating tag '%tag_name%'...
30+
git tag "%tag_name%"
31+
32+
if errorlevel 1 (
33+
echo Error: Failed to create tag
34+
exit /b 1
35+
)
36+
37+
set /p push_confirm="Push to remote? [Y/n]: "
38+
39+
if /i not "%push_confirm%"=="n" (
40+
git push origin "%tag_name%"
41+
)
42+
43+
echo Done. Tag '%tag_name%' created.
44+
goto :eof

tag_manager.fish

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env fish
2+
3+
function main
4+
read -P "Enter tag name: " tag_name
5+
6+
if test -z "$tag_name"
7+
echo "Error: Tag name required"
8+
exit 1
9+
end
10+
11+
if not git rev-parse --git-dir >/dev/null 2>&1
12+
echo "Error: Not in a Git repository"
13+
exit 1
14+
end
15+
16+
if git tag -l | grep -q "^$tag_name\$"
17+
echo "Tag '$tag_name' exists. Deleting..."
18+
git tag -d "$tag_name"
19+
20+
if git ls-remote --tags origin | grep -q "refs/tags/$tag_name\$"
21+
git push origin --delete "$tag_name"
22+
end
23+
end
24+
25+
echo "Creating tag '$tag_name'..."
26+
git tag "$tag_name"
27+
28+
if test $status -ne 0
29+
echo "Error: Failed to create tag"
30+
exit 1
31+
end
32+
33+
read -P "Push to remote? [Y/n]: " push_confirm
34+
35+
if test "$push_confirm" != "n" -a "$push_confirm" != "N"
36+
git push origin "$tag_name"
37+
end
38+
39+
echo "Done. Tag '$tag_name' created."
40+
end
41+
42+
main

0 commit comments

Comments
 (0)