📝 Edit page
➕ Add page
NPM version
How to keep git tags in sync with GitHub for an NPM project
Note: If you only tag your repo using the CLI and not the GitHub UI, you can leave off the fetch. As npm version
will use the "version"
field in package.json
to incremen the tag, not git tags.
Manual
$ git fetch --tags
$ npm version minor
$ git push --follow-tags
Or
$ git fetch --tags && npm version minor && git push --follow-tags
Package commands
Or set up your package.json
:
{
"scripts": {
"preversion": "git fetch --tags",
"postversion": "git push --follow-tags"
}
}
And run:
$ npm version