
tago
Smart Git tag version management built with Golang.
CHINESE README
δΈζθ―΄ζ
Main Features
π·οΈ Smart Tag Management: Auto create and bump semantic version tags in Git repositories
β‘ Version Base System: Configurable version increment mechanism (1/10/100)
π― Interactive Confirmation: When using low version base, asks before operations; high version base enables auto mode
π Submodule Support: Independent tag management in main project and submodules
π Semantic Versioning: Follows v{major}.{minor}.{patch} format standards
Installation
go install github.com/go-mate/tago/cmd/tago@latest
Usage
tago
output:
refs/tags/v0.0.0 Wed Feb 12 16:18:18 2025 +0700
refs/tags/v0.0.1 Thu Feb 13 16:43:08 2025 +0700
refs/tags/v0.0.2 Thu Feb 13 18:43:40 2025 +0700
refs/tags/v0.0.3 Wed Apr 30 15:18:56 2025 +0700
refs/tags/v0.0.4 Wed May 7 18:38:38 2025 +0700
Initialize Repo with First Tag
Create the first tag when no tags exist in the repo:
# Create v0.0.0 tag (default)
tago init
# Create custom version tag
tago init --major=1 --minor=0 --patch=0
tago init -a=0 -b=1 -c=0
The init command handles these scenarios:
- No tags exist: Creates new tag with interactive confirmation
- Different tag exists: Reports what tag exists and prevents execution
- Same tag exists at current commit: Skips creation and asks if you want to push
- Same tag exists at different commit: Reports commit mismatch and prevents execution
Example workflow:
# First time - creates tag
$ tago init
Create tag v0.0.0? (Y/n): Y
Push tag v0.0.0 to remote? (Y/n): Y
SUCCESS
# If tag exists at current commit - asks about push action
$ tago init
Tag v0.0.0 exists at current commit
Push tag v0.0.0 to remote? (Y/n): Y
SUCCESS
Bump Tag Version (Interactive Mode)
Bump from va.b.c to va.b.c+1 and push new tag with interactive confirmation:
tago bump
Output:
cd xxx && git push origin v0.0.5
Bump Tag Version (Auto Mode)
Bump from va.b.c to va.b.c+1 and push new tag without interactive confirmation:
tago bump -b=100
Output:
cd xxx && git push origin v0.0.5
Main Project Tag Management
When working in main project root DIR:
tago bump main
tago bump main -b=10
Submodule Tag Management
When working in submodule DIR (with path prefix):
cd submodule-dir
tago bump sub-module
tago bump sub-module -b=100
Requirements
- Git Repo: Must be run inside a valid Git repo
- Git Branch: Assumes main branch is named "main" (not "master")
- Tag Format: Tags must follow semantic versioning
v{major}.{minor}.{patch} format
Version Base System
The version base (-b option) controls version increment mechanism:
- 0 and 1: Interactive mode, asks before each action
- β₯ 2: Auto mode, supports automatic version increment
Version Increment Examples
With version base 10:
v1.2.9 β v1.3.0 (patch reaches base, advances to next minor)
v1.9.8 β v1.9.9 (standard increment)
v1.9.9 β v2.0.0 (minor reaches base, advances to next major)
Advanced Usage
Command Examples
# Show current tags
tago
# Bump tag (with confirmation)
tago bump
# Quick bump without confirmation
tago bump -b=100
# Main project tag bump
tago bump main -b=10
# Submodule tag bump (run from submodule DIR)
cd my-submodule
tago bump sub-module -b=10
Version Management Workflow
- When development completes: Run
tago to view current tags
- Create new version: Run
tago bump to upgrade version
- Automation scenarios: Use
tago bump -b=100 to skip confirmation
- Multi-module projects: Use appropriate subcommands based on context
Core Capabilities
Smart Version Management
- Auto parse existing tag formats
- Support semantic versioning standards
- Handle version increment logic
- Validate Git repo status
Flexible Confirmation System
- Low version base: Interactive confirmation before each action
- High version base: Auto execution, suitable when scripting
- Simple and effective prompt messages
- Operation cancellation support
Multi-project Architecture Support
- Main project tags:
v{major}.{minor}.{patch}
- Submodule tags:
{path}/v{major}.{minor}.{patch}
- Path-aware tag management
- Git submodule compatible design
Troubleshooting
Common Issues
Issue: "no tag found in repo"
- Cause: No existing tags in the repo
- Solution: Use init command:
tago init to create the first tag with interactive confirmation
Issue: "not in submodule path"
- Cause: Running
tago bump sub-module from project root instead of submodule DIR
- Solution: Navigate to the submodule DIR before running the command
Issue: "tag format mismatch"
- Cause: Existing tag doesn't match required
v{major}.{minor}.{patch} format
- Solution: Ensure tags follow semantic versioning format (e.g., v1.2.3, not v1.2 / 1.2.3)
Issue: "no matching tag found"
- Cause: No tags matching the expected pattern (e.g., looking at main project tags when just submodule tags exist)
- Solution: Create appropriate tag format based on command context (main vs sub-module)
Issue: Push fails with "origin does not seem to be a git repo"
- Cause: No remote repo configured
- Solution: Add remote:
git remote add origin <url> and use -b=0 to skip auto-push
- Valid formats:
v0.0.1, v1.2.3, v10.20.30
- Invalid formats:
v1.2, 1.2.3, version-1.2.3, v1.2.x
- Submodule tags:
mymodule/v1.2.3, path/to/module/v0.1.0
π License
MIT License - see LICENSE.
Contributions are welcome! Report bugs, suggest features, and contribute code:
- π Mistake reports? Open an issue on GitHub with reproduction steps
- π‘ Fresh ideas? Create an issue to discuss
- π Documentation confusing? Report it so we can improve
- π Need new features? Share the use cases to help us understand requirements
- β‘ Performance issue? Help us optimize through reporting slow operations
- π§ Configuration problem? Ask questions about complex setups
- π’ Follow project progress? Watch the repo to get new releases and features
- π Success stories? Share how this package improved the workflow
- π¬ Feedback? We welcome suggestions and comments
π§ Development
New code contributions, follow this process:
- Fork: Fork the repo on GitHub (using the webpage UI).
- Clone: Clone the forked project (
git clone https://github.com/yourname/repo-name.git).
- Navigate: Navigate to the cloned project (
cd repo-name)
- Branch: Create a feature branch (
git checkout -b feature/xxx).
- Code: Implement the changes with comprehensive tests
- Testing: (Golang project) Ensure tests pass (
go test ./...) and follow Go code style conventions
- Documentation: Update documentation to support client-facing changes
- Stage: Stage changes (
git add .)
- Commit: Commit changes (
git commit -m "Add feature xxx") ensuring backward compatible code
- Push: Push to the branch (
git push origin feature/xxx).
- PR: Open a merge request on GitHub (on the GitHub webpage) with detailed description.
Please ensure tests pass and include relevant documentation updates.
π Support
Welcome to contribute to this project via submitting merge requests and reporting issues.
Project Support:
- β Give GitHub stars if this project helps you
- π€ Share with teammates and (golang) programming friends
- π Write tech blogs about development tools and workflows - we provide content writing support
- π Join the ecosystem - committed to supporting open source and the (golang) development scene
Have Fun Coding with this package! πππ
GitHub Stars
