Emacs shell: save commit message


I've started using emacs a few days ago, and I'm facing a problem when using git in the emacs shell (M-x shell). When I 'git commit' or 'git commit --amend', it opens vim to edit and save the commit message. I'm ok with that, but I can't find a way to save and exit vim, since hitting ESC does not trigger vim Normal Mode, and ESC is my emacs metakey. I tryed changing my git editor to emacs, but it doesn't work either, it seems like emacs shell cannot run emacs, and it doesn't open a new buffer like I thought it would.

emacs: Terminal type "dumb" is not powerful enough to run Emacs.

Is there a way I can use git command-line (I'd rather not have to use a git front-end client like magit, ...) with the emacs shell ?

Thanks, Robin


You can change your editor to something more simple, like nano, using

git config core.editor nano

Or you could just make it no open any editor by putting your message on the command line :

git commit --amend -m "My message"


Posting the answer from @romainl in comment since it does what I want: <C-o> to get out of insert mode, :wq or :x and Enter.


One other, round-about, way to do this is to use gits abiltiy to use a file as a commit message:

<ol><li>before you commit write your commit message (in emacs) in a temporary file</li> <li>commit with: git commit -F temp_file_name</li> <li>erase the file</li> </ol>


  • Joomla Unknown column JReviews
  • Is it possible to use the keyboard to trigger a File Browser in JavaScript?
  • vim: Wrap current line in a /* */ comment
  • Hamburgler.js button not working on mobile devices
  • modifying text of a div using dojo
  • Ordered http request parameters
  • TypeScript to JavaScript transpiler for Angular2
  • How to dispatch an KeyboardEvent with specific KeyCode
  • Creating foreign key in MySQL
  • TFS express error: The working folder C:\\LocalFolder is already in use
  • How do I embed a custom user-control in MS Word?
  • gulp.watch running same task multiple times when saving many files
  • 2-table interaction: insert, get result, insert
  • CKeditor stripping font tags instead of converting to span
  • How can I add div content to a new page in jspdf?
  • Interpreting STRACE output - pipes and forks
  • Primefaces lazy datascroller calling load twice
  • how to populate a SQLite database and use that database in phonegap?
  • Symfony 2 error page response
  • MeeGo Handset Emulator not starting on Windows 7
  • How to access meteor package name inside package?
  • Getting media player state in windows phone 7
  • Rest Services conventions
  • How can I tell a form not to dispose a particular control when it closes?
  • Hash Code in SQL Server?
  • SonarQube: Cannot deactivate rule with missing quality profile
  • How to add a focus style to an editable ComboBox in WPF
  • Intel-64 and ia32 atomic operations acquire-release semantics and GCC 5+
  • Read text file that is not in the main package in a runnable jar
  • Is playing sound in Javascript performance heavy?
  • How to handle images sent by a mobile device?
  • How do I get HTML corresponding to current DOM tree?
  • Setting up SourceTree to merge unity3d scenes with UnityYAMLMerge
  • Recording logins for password protected directories
  • Pass value from viewmodel to script in zk
  • How to show dropdown in excel using jrxml (jasper api)?
  • WPF Applying a trigger on binding failure
  • Benchmarking RAM performance - UWP and C#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass