简体   繁体   English

如何使用npm脚本通过自定义提交消息推送到github?

[英]How to push to github with custom commit message with npm scripts?

In my package.json I have this 在我的package.json我有这个

  "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. 在终端中,我运行npm run git并推送更改。 But how can I change the commit message on the fly? 但是,如何动态更改提交消息? For example npm run git MESSAGE='another commit' 例如npm run git MESSAGE='another commit'

A solution involving some npm trickery might consist of: 涉及一些npm欺骗的解决方案可能包括:

"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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM