Back to blog
thatonevikash

Push tags on GitHub

Learn about the best approach of pushing a tag on github, unlike separate push for tag and package version it is better to combine them into one single command.

On this page

Best way to push tag on github

Noob approach of pushing a tag

If you are using the command as

# lists all tags
git tag

# creates a new tag
git tag v0.1.1

Then you push on that tag

# push on github
git push origin v0.1.1

Know

It doesn't update your package.json
It doesn't anchor your package version.

Now have to manually update the package version and push it separately.

# 1. update package version
npm version patch

# 2. push a separate commit
git push

Note

patch for 0.0.*
minor for 0.*.0
major for *.0.0

Pro approach of pushing a tag

# 1. Bumps version, updates package.json, commits, and tags locally
npm version patch

# 2. Pushes the commit to main AND pushes the newly created tag simultaneously
git push origin main --follow-tags

Thanks for reading 💖!