Tuesday, July 21, 2020

Using emacs as a commit editor from GitBash

For some reason, perhaps related to tinkering with Flutter, my commit editor settings went wonky on Windows. Trying to rebase from Git Bash was connecting to Visual Studio Code rather than Emacs. Using Emacs is an important part of my workflow because of the ease with which rectangles of text can be replaced, such as when choosing to squash sequences of commits. (That's M-x replace-rectangle for the curious.)
It took much too long for me to get the proper setting back in place to run emacs as my commit editor, so I'm tracking it here, in case I need it later. Here's the command:

git config --global core.editor "c:/program\ files/emacs/bin/emacsclient.exe -c -a ''"

Yes, all that punctuation at the end is significant.

UPDATE: It turns out this isn't quite right. It works once, but then on subsequent rebases, emacs opens with an empty buffer and a message that the file on disk has changed. I didn't have to do this before, so whatever configuration I had before that worked, this wasn't it.

No comments:

Post a Comment