Using git bash in Windows, I set my core.editor
to the following:
c:/program/emacs-24.2/bin/emacs --no-splash -geometry 110x58+200+2
Upon git commit
, a new emacs frame opens as expected. The opened buffer has $@
as a name. I cannot save the buffer and exit emacs. Git complains that the commit message was empty.
I have a workaround, which is to set my core.editor
to:
c:/program/emacs-24.2/bin/emacs --no-splash -geometry 110x58+200+2 .git/COMMIT_EDITMSG
This works, but with a couple of drawbacks:
COMMIT_EDITMSG
, one with $@
.Is there a better way to choose emacs as commit editor (besides making it open in the terminal)?
I suggest that you either
Emacs
as usual and start the server with Mx server-start RET
or add (server-start)
to .emacs
and use emacsclient
instead of emacs
as your core.editor
if you insist on running git
from the command line (hit Cx # in the client buffer when done editing to pass the control back to git
).
However, the best way to use Emacs
with git
is vc
:
In Emacs
, type Cx vd your/git/repo/root/dir RET to get the list of modified files, mark those you want to commit with m , type Cx vv to commit them - a buffer for the commit message appears (initialized for you with the ChangeLog
entry, if any), edit it, type Cc Cc and you are done.
Another very nice interface to git
within emacs is provided by magit
. The idea behind magit
is to provide you with an interactive interface within emacs to easily run all the frequently used git commands, essentially eliminating the need for you to directly run git
from the commands-line.
Although it is not standard (unlike vc
, which was mentioned in another answer), you can install it very simply using the packaging system, for example from the melpa or marmalade repositories.
This works for me under msysgit 1.7.11:
git config core.editor '/d/bin/emacs-24.3/bin/emacs.exe'
but when I switched to this:
git config core.editor '/d/bin/emacs-24.3/bin/emacs.exe --no-splash'
I got the same '$@' buffer as you do.
Nothing I found online worked the way I wanted, and surprisingly I did not see this command yet..so, here is how I made emacs work in Git for windows:
git config --global core.editor "'C:\Program Files\Emacs\x86_64\bin\runemacs.exe' -wait"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.