Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can you add a variable for the version in the commit message? #29

Closed
RTSchriner opened this issue Feb 7, 2019 · 3 comments
Closed

Can you add a variable for the version in the commit message? #29

RTSchriner opened this issue Feb 7, 2019 · 3 comments

Comments

@RTSchriner
Copy link

RTSchriner commented Feb 7, 2019

Can you add a variable for the version in the commit message?

npm version does this. See https://docs.npmjs.com/cli/version.html

If supplied with -m or --message config option, npm will use it as a commit message when creating a version commit. If the message config contains %s then that will be replaced with the resulting version number. For example: npm version patch -m "Upgrade to %s for reasons"

So%s becomes the version - bump --premajor --lock --commit "release %s to the wild"

Thanks!

@JamesMessinger
Copy link
Member

The --commit option allows you to specify a custom commit message. The version number is appended to your message, so if you do bump --commit "Upgrading to v" then the commit message will be Updating to vX.X.X.

I do like the idea of being able to put the version number anywhere in the message via a placeholder. And I think I can add that in a backward-compatible way, too. Basically, if the message contains the placeholder, then replace it with the version number. Otherwise, just append the version number.

@RTSchriner
Copy link
Author

Thanks for taking the time to respond!

The version number is appended to your message...
Ah, I didn't realize the that. That'll actually work for what I need then.

Thank you, very much!

@JamesMessinger
Copy link
Member

I just released version 5.0.0, which resolves this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants