Skip to content

Tag and Release Project

Easy ~15 min

What you'll build

A repository with multiple version tags (v1.0.0, v1.1.0, v2.0.0) representing releases. You will inspect, checkout, and push tags to share release points.

Goals

  • Create annotated tags with git tag -a
  • List and inspect tags with git tag and git show
  • Checkout a tagged version to inspect a past release
  • Push tags to a remote repository

Prerequisites

  • git init, add, commit

Steps

  1. 1

    Set up a project with multiple commits

    Create a repo and make three commits representing three versions of a simple app.

    Code
    mkdir tag-project
    cd tag-project
    git init
    echo "v1.0" > version.txt
    git add .
    git commit -m "Initial release v1.0"
    echo "v1.1" > version.txt
    git commit -am "Update to v1.1"
    echo "v2.0" > version.txt
    git commit -am "Major update to v2.0"

    Expected result

    A repo with three commits, each updating version.txt.

  2. 2

    Create annotated tags for each release

    Tag the first commit as v1.0.0, the second as v1.1.0, and the current as v2.0.0. Annotated tags store a message and metadata.

    Code
    git tag -a v1.0.0 HEAD~2 -m "First stable release"
    git tag -a v1.1.0 HEAD~1 -m "Minor feature update"
    git tag -a v2.0.0 -m "Major release with breaking changes"

    Expected result

    Three annotated tags marking release points in history.

  3. 3

    List and inspect tags

    List all tags and inspect a specific tag to see its metadata and the commit it points to.

    Code
    git tag
    git show v1.0.0

    Expected result

    git tag lists v1.0.0, v1.1.0, v2.0.0; git show displays the tag details.

  4. 4

    Checkout a past release

    Checkout the v1.0.0 tag to see the project as it was at that release. You enter a detached HEAD state — this is expected for inspecting a past version.

    Code
    git checkout v1.0.0
    cat version.txt  # shows v1.0
    git checkout main  # return to latest

    Expected result

    version.txt shows v1.0 at the tag, then returns to v2.0 on main.

  5. 5

    Push tags to a remote

    Tags are local only by default. Push them to share release points with the team. You can push all tags or specific ones.

    Code
    # Push a specific tag
    git push origin v2.0.0
    # Or push all tags at once
    git push --tags

    Expected result

    Tags are now available on the remote repository.

Try it yourself

What you learned

You created annotated tags for version releases, inspected them, checked out a past release, and pushed tags to a remote. Tags are the standard way to mark release points in Git history.

Related Resources

Related Lessons

  • git tags

    Learn annotated and lightweight tags.

Related Cheatsheets

Look up unfamiliar terms

A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.

View glossary

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to topic