[英]git commit with emacs as editor under Windows
在 Windows 中使用 git bash,我將core.editor
設置為以下內容:
c:/program/emacs-24.2/bin/emacs --no-splash -geometry 110x58+200+2
git commit
git 后,將按預期打開一個新的 emacs 框架。 打開的緩沖區以$@
作為名稱。 我無法保存緩沖區並退出 emacs。Git 抱怨提交消息為空。
我有一個解決方法, core.editor
設置為:
c:/program/emacs-24.2/bin/emacs --no-splash -geometry 110x58+200+2 .git/COMMIT_EDITMSG
這可行,但有幾個缺點:
COMMIT_EDITMSG
,一個帶有$@
。有沒有更好的方法來選擇 emacs 作為提交編輯器(除了在終端中打開它之外)?
我建議你
Emacs
並使用Mx server-start RET
或將(server-start)
添加到.emacs
如果你堅持從命令行運行git
,那么使用emacsclient
而不是emacs
作為你的core.editor
(在完成編輯后,在客戶端緩沖區中點擊Cx#將控制權傳回git
)。
但是,使用git
使用Emacs
的最佳方法是vc
:
在Emacs
,鍵入Cx vd your / git / repo / root / dir RET以獲取已修改文件的列表,標記要使用m提交的文件,鍵入Cx vv以提交它們 - 將顯示提交消息的緩沖區(已初始化為你使用ChangeLog
條目(如果有的話),編輯它,鍵入Cc Cc ,你就完成了。
這在msysgit 1.7.11下適合我:
git config core.editor '/d/bin/emacs-24.3/bin/emacs.exe'
但是當我切換到這個:
git config core.editor '/d/bin/emacs-24.3/bin/emacs.exe --no-splash'
我和你一樣有'$ @'緩沖區。
我在網上找到的任何東西都沒有按照我想要的方式工作,令人驚訝的是我還沒有看到這個命令..所以,這是我如何讓 emacs 在 Git 中為 windows 工作:
git config --global core.editor "'C:\Program Files\Emacs\x86_64\bin\runemacs.exe' -wait"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.