ZYinMD
ZYinMD

Reputation: 5059

When running `npm version` scripts, how to prevent a new commit from being made

When I run npm version patch, a new commit will be made. I don't want it.

The doc is pretty vague. The flag I guess is relevant is commit-hooks, but I'm not sure how to use it. There's no examples.

I've tried different patterns, for example:

npm version patch --commit-hooks=false

npm version patch --commit-hooks false

But it doesn't seem to work.

Upvotes: 6

Views: 7313

Answers (2)

If run in a git repo, it will also create a version commit and tag. This behavior is controlled by git-tag-version (see below), and can be disabled on the command line by running npm --no-git-tag-version version.

Upvotes: 5

0xLogN
0xLogN

Reputation: 3805

The --commit-hooks argument determines if Git Hooks are run on the commit creation.

The command you want is npm version patch --git-tag-version false

Tag the commit when using the npm version command. Setting this to false results in no commit being made at all.

Upvotes: 13

Related Questions