[英]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.