0

我一直在尝试做的是创建一个 git 别名,以便git heroku Fix that bug运行:

git add .
git commit -m "Fix that bug"
git push heroku master

这是我迄今为止尝试过的:

heroku = "!f() { git add .; git commit -m \"$@\"; git push heroku master; }; f"

到目前为止似乎是最有希望的,但如果我这样做git heroku test test了,它告诉我error: pathspec 'test' did not match any file(s) known to git.

我也尝试过其他一些类似的方法!sh -c 'git add ...' -,但效果也不太好。

有人知道怎么修这个东西吗?(以及为什么会出现该消息)

4

1 回答 1

0

我强烈建议您将日志消息作为单个带引号的字符串传递。即使在大多数情况下您可以使用未引用的单词列表来解决问题

git commit -m "$*"

最终,您尝试使用提交消息,例如

git heroku Replace * with #

您将在提交消息中获得文件名列表。习惯就好

git heroku "Replace * with #"

并将您的别名定义为

heroku = '!f() { git add .; git commit -m "$1"; git push heroic master; }; f'
于 2014-12-10T21:34:27.303 回答