2016-08-11 25 views
-1

我可以使用git commit -a來提交一條消息並打開vim進行編輯。但是這個命令會自動提交所有已修改的內容。我真的很想用`git commit -m'來提交。但是這個命令不會調用vim編輯器。如何解決這個問題。git commit -m將不會捲入vim來編輯

+0

所以你想運行'git commit -m「my message」',讓編輯器打開,並且已將「my message」添加到提交消息中? – chepner

+0

@chepner是的,我想更仔細地編輯此消息。 – buzhidao

+0

所以,只需輸入'git commit'而無任何參數? – 1615903

回答

4

此選項似乎是你要找的:

-e, --edit 
     The message taken from file with -F, command line with -m, and from 
     commit object with -C are usually used as the commit log message 
     unmodified. This option lets you further edit the message taken 
     from these sources. 
+0

你太棒了!你知道我想要什麼 – buzhidao

1

您可以使用git commit不帶任何參數。它將啓動你的配置文本編輯器(默認是vim),這樣你就可以在那裏輸入提交信息。

+0

第一句話是對的,第二句是不對的,你需要明確地將你的默認編輯器設置爲vim。 – buzhidao