Nathan Kamenar
Nathan Kamenar

Reputation: 884

Permanently disable git tag version for npm version

When running the command "npm version" you can provide a --no-git-tag-version flag to stop tags from being generated and committed. Is there a way to make this the default behavior so I don't have to remember to type --no-git-tag-version every time?

Upvotes: 9

Views: 6326

Answers (2)

Nipuna
Nipuna

Reputation: 362

You can use,

npm config set git-tag-version false

to stop npm version permanently from creating tags and commits for npm version updates.

Note: This will be affected globally.

Upvotes: 4

mnestorov
mnestorov

Reputation: 4484

The first thing that comes to mind that is relatively easy to do is make an alias for this specific command. Something like

alias npm-nt="npm version --no-git-tag-version" # npm version no tag

Then just call npm-nt instead of npm version --no-git-tag-version.


Edit - given the comment about that this configuration should be shared with others, an option is to set this flag to false through npm config

By the docs of npm it's stated that this flag is true by default.

This in a project specific .npmrc file this can be set to false and can look something like

# in .npmrc
git-tag-version=false

Upvotes: 11

Related Questions