Logo Logo BW diosito's blog
Git Tags

Git Tags

December 9, 2024
3 min read
Table of Contents

Git Tags: Your Codeโ€™s Time Capsules ๐Ÿš€

Git tags serve as crucial markers that help you track significant points in your projectโ€™s history. Letโ€™s explore how to use them effectively in your workflow!

What Exactly Are Git Tags? ๐Ÿท๏ธ

Think of Git tags like checkpoints in a video game. When you reach a significant point in your journey, you save your progress so you can return to it later. Git tags do the same for your code, marking specific commits so you can easily revisit them.

Two Flavors of Git Tags

  1. Lightweight Tags: Quick and simple - just a name for a specific commit.
  2. Annotated Tags: The deluxe version! Includes:
    • Tagger name
    • Email
    • Date
    • Tagging message
    • Optional signature

Examples: When to Use Git Tags ๐Ÿšฆ

  • Marking release versions (v1.0.0, v1.1.0-beta)
  • Capturing project milestones
  • Highlighting important commits
  • Creating release points for deployment

Practical Example: Tagging in Azure DevOps ๐Ÿ’ป

Letโ€™s walk through tagging a beta release step-by-step:

  1. Open Azure DevOps portal
  2. Navigate to Repos section
  3. Click on Tags
  4. Select New tag
  5. Fill in details:
    • Name: v1.1.0-beta
    • Based on: main branch
    • Description: Beta release v1.1.0

Pro Tip: Always use semantic versioning (Major.Minor.Patch) for clarity!

Quick Git Tag Commands ๐Ÿš€

# Create a lightweight tag
git tag v1.1.0-beta
 
# Create an annotated tag
git tag -a v1.1.0-beta -m "Beta release version"
 
# Push tags to remote
git push origin v1.1.0-beta

Best Practices ๐ŸŒŸ

  • Be consistent with your tag naming
  • Use meaningful descriptions
  • Donโ€™t modify tags after pushing
  • Treat tags as immutable landmarks

Online Resources

Remember: Tags are your projectโ€™s historical GPS. Use them wisely! ๐Ÿ—บ๏ธ