如何使用npm脚本使用自定义提交消息推送到github? [英] How to push to github with custom commit message with npm scripts?

查看:121
本文介绍了如何使用npm脚本使用自定义提交消息推送到github?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的package.json中,我有这个

  "scripts": {
    "start": "gulp serve",
    "git": "git add . && git commit -m 'some-message' && git push --all"
  },

在终端中,我运行npm run git并推送更改.但是,如何动态更改提交消息?例如npm run git MESSAGE='another commit'

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'

推荐答案

涉及npm欺骗的解决方案可能包括:

A solution involving some npm trickery might consist of:

"scripts": {
  "git": "git add . && git commit -m",
  "postgit": "git push --all"
},

要这样称呼:

npm run git -- "Message of the commit"

或:

npm run git -- Message

这篇关于如何使用npm脚本使用自定义提交消息推送到github?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆