Techtrekking
TutorialsGitHow to push tags from local repository to Github
Chapter 3 of 4

How to push tags from local repository to Github

By Pravin

What are Git Tags?

Git tags are used to mark specific points in a repository’s history, usually for release versions (e.g., v1.0.0, v2.1.3). Unlike branches, tags are fixed and do not change over time.

The tag will only refer to the last committed changes — not your uncommitted (local) changes. If you want to create tag with your latest changes, please ensure Local version is committed locally. If you push a tag, Git will automatically push the commit(s) that the tag points to (if they are not already on GitHub).

Step 1: Commit and push changes

Commit your changes and push to github

git add . git commit -m "v0.0.7" git push origin main

Step 2: Create a Tag

Ensure You Are on the Correct Commit

git status git log --oneline -5

Option A. Lightweight Tag (Not Recommended for Releases)

A lightweight tag is like a simple pointer to a commit:

git tag v1.0.0

⚠️ These tags are not annotated and don’t store extra metadata like author or date.

Option B. Annotated Tag (Recommended for Releases)

Annotated tags store metadata such as author, date, and message:

git tag -a v0.0.1 -m "v0.0.1 release"

Step 3: Push Tags to GitHub

By default, tags are not pushed when you push commits. You need to push them manually:

git push origin v0.0.1

To push all tags at once:

git push origin --tags

Step 4: Verify Tags

To see all created tags:

git tag

To see tag details (for annotated tags):

git show v1.0.0

Typical Release Flow

# push your changes first git add . git commit -m "Final changes before release" git push origin main # create and push tag git tag -a v1.0.0 -m "Production release" git push origin v1.0.0

After pushing, the tag will appear under GitHub → Repository → Releases / Tags. You can then create a formal release from the GitHub UI if required.

Comments
No comments yet. Be the first to comment!
Leave a Comment
Your comment will be visible after approval.
How to push tags from local repository to Github | Git | TechTrekking