Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure gedit as git core.editor?

Tags:

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 
like image 995
Demyn Avatar asked Oct 18 '13 17:10

Demyn


People also ask

How do I change the core editor in git?

The command to do this is git config --global core. editor "nano" . You can change the highlighted section with your editor of choice!

What should I use as default editor in git?

On Windows, if you use Git Bash the default editor will be Vim. Vim is another text editor, like nano or notepad.


1 Answers

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" 
like image 140
Arnaud P Avatar answered Sep 17 '22 13:09

Arnaud P