Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
(Git)如何使用alias设置参数_Git - Fatal编程技术网

(Git)如何使用alias设置参数

(Git)如何使用alias设置参数,git,Git,我经常使用下面的命令 $git commit -am "something message" 在设置alias之后,很遗憾,这样做不起作用 .gitconfig文件是 [alias] am = "!f(){ git commit -am \"$1\";};f" 然后我试着 $ git am "modified something logic" 发生了一些错误 fatal: could not open 'filepath//modified something logic: No

我经常使用下面的命令

$git commit -am "something message"

在设置alias之后,很遗憾,这样做不起作用

.gitconfig文件是

[alias]
    am = "!f(){ git commit -am \"$1\";};f"
然后我试着

$ git am "modified something logic"
发生了一些错误

fatal: could not open 'filepath//modified something logic: No such file or directory
设置别名有什么问题


谢谢。

am
是一个内置命令:

$ git help am

NAME
   git-am - Apply a series of patches from a mailbox

为您的别名选择另一个名称(并检查它是否已被使用…

正如LeGEC建议的那样,我将别名改为coam

$ git config --global alias.coam '!f(){ git commit -am "$1";};f'
之后,我可以使用下面的命令,该命令等于$git commit-am“something message”


使用选项-a和-m不需要设置别名。从配置文件中删除别名,然后在设置别名后,您的命令
git commit-am“something message”
应该可以正常工作”,不幸的是,这样做效果不好。“您得到了什么输出?另外
git commit-am
也不需要别名。最好是手动准备必要的文件,然后提交它们,最好使用git提交,而不是
git commit-m
我想使用捷径使用别名来减少键入。你绝对是对的!!我不知道我是指挥官!!谢谢!!
$ git coam "something message"