2017-06-13 117 views
0

好吧,使用google搜索10分鐘,我找到的唯一例子是關於別名的東西,比如commit -m,但我怎麼會混淆一個命令,如git commit -m?我嘗試使用git config --global alias.gco "git commit -m",但這也只適用於第一個命令(commit -m)。我也嘗試手動將該命令添加到gitconfig文件,但那也不起作用。如何在Git中混淆git命令?

這是不可能的嗎?

我想達到的目標:

我想別名此:git commit -m這樣,而不是打字git commit -m,我只需鍵入gco

+0

你試過'混帳配置 - 全球alias.gco'提交-m''?我很確定我不明白你的問題。 –

+0

試試這個https://github.com/GitAlias/gitalias/blob/master/gitalias.txt#L234 – ckruczek

+0

@ LasseV.Karlsen是的,別名該命令的作品,但別名'git commit -m'命令不起作用。對不起,有一個語法錯誤,一定是你的困惑根源於哪裏。 – macbeth

回答

6

按照您在評論中提供的信息,它看起來像你想要bash別名,而不是git。

下面讓您透過gco在命令行提交:

# Add me to your ~/.bashrc 
alias gco='git commit -m' 

但這是git的別名,通過git gco執行:

git config --global alias.gco "commit -m" 
+0

請注意,我寫了這個答案儘可能可讀。如果你是書呆子,請用'shell','.bashrc'替換'bash',以適合你的外殼,等等。 –

+0

That works,thanks !!! – macbeth