How to configure gedit as git core.editor?

Demyn picture Demyn · Oct 18, 2013 · Viewed 17.4k times · Source

I have gedit configured as git core.editor.

git config --global core.editor "gedit"

This works fine unless there is already a gedit windows open. In that case, COMMIT_EDITMSG is opened in the existing window and gedit returns immediately. Git ends up with an empty commit message and fails.

This site (http://fabianschuiki.wordpress.com/2012/05/20/use-gedit-as-git-editor/) suggests using "gedit -s -w", but I don't have those options (and --new-window doesn't work):

$ gedit -V
gedit - Version 2.28.4

$ gedit --help
Usage:
  gedit [OPTION...] [FILE...] - Edit text files

Help Options:
  -h, --help                      Show help options
  --help-all                      Show all help options
  --help-gtk                      Show GTK+ Options
  --help-sm-client                Show session management options

Application Options:
  -V, --version                   Show the application's version
  --encoding=ENCODING             Set the character encoding to be used to open the files listed on the command line
  --list-encodings                Display list of possible values for the encoding option
  --new-window                    Create a new toplevel window in an existing instance of gedit
  --new-document                  Create a new document in an existing instance of gedit
  --display=DISPLAY               X display to use

Answer

Arnaud P picture Arnaud P · Jan 4, 2017

All credit to VonC answer, but the -w makes gedit (3.18) crash on my ubuntu 16.04. Works fine without though:

git config --global core.editor "gedit -s"