2016-02-25 46 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"