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 M-x 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 C-x # 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 C-x v d your/git/repo/root/dir RET to get the list of modified files, mark those you want to commit with m, type C-x v v to commit them - a buffer for the commit message appears (initialized for you with the ChangeLog entry, if any), edit it, type C-c C-c and you are done.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With