Right answer
To do so, just npm version patch
=)
My old answer
There is no pre-release
hook originally in git
. At least, man githooks
does not show it.
If you're using git-extra
(https://github.com/visionmedia/git-extras), for instance, you can use a pre-release
hook which is implemented by it, as you can see at https://github.com/visionmedia/git-extras/blob/master/bin/git-release. It is needed only a .git/hook/pre-release.sh
executable file which edits your package.json
file. Committing, pushing and tagging will be done by the git release
command.
If you're not using any extension for git
, you can write a shell script (I'll name it git-release.sh
) and than you can alias it to git release
with something like:
git config --global alias.release '!sh path/to/pre-release.sh $1'
You can, than, use git release 0.4
which will execute path/to/pre-release.sh 0.4
. Your script can edit package.json
, create the tag and push it to the server.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…