问题
In my package.json
I have this
"scripts": {
"start": "gulp serve",
"git": "git add . && git commit -m 'some-message' && git push --all"
},
In the terminal I run npm run git
and the changes are pushed. But how can I change the commit message on the fly? For example npm run git MESSAGE='another commit'
回答1:
A solution involving some npm trickery might consist of:
"scripts": {
"git": "git add . && git commit -m",
"postgit": "git push --all"
},
To be called like:
npm run git -- "Message of the commit"
or:
npm run git -- Message
来源:https://stackoverflow.com/questions/44459774/how-to-push-to-github-with-custom-commit-message-with-npm-scripts