2016-02-25 43 views
2

参数我ofter使用下面的命令(GIT)如何设置使用别名

$git commit -am "something message" 

设置别名后,不幸的会无法正常工作。

的.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 

设置别名有什么问题?

谢谢。

+1

你不需要设置别名使用的选项-a和-m。从你的配置文件中删除别名,然后你的命令'git commit -am'什么信息“'应该可以正常工作 –

+1

”设置别名后,不幸的是这样做效果不好。“你得到了什么输出? –

+1

另外'git commit -am'不是你应该需要别名的东西。最好是手动分配必要的文件,然后提交它们,最好使用git commit而不是'git commit -m' – TheGeorgeous

回答

2

am是一个内置的命令:

$ git help am 

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

选择您的别名的另一个名字(并检查它是不是已经采取了...)

+0

你绝对是对的!我不知道这是命令! 非常感谢! – Harry

0

由于LeGEC劝我,我改变别名coam而是我。

$ git config --global alias.coam '!f(){ git commit -am "$1";};f' 

在那之后,我可以使用下面的命令等于$ git的承诺-am“一些信息”

$ git coam "something message"