Skip to content

Instantly share code, notes, and snippets.

@nnja
Created October 5, 2017 05:00
Show Gist options
  • Star 53 You must be signed in to star a gist
  • Fork 20 You must be signed in to fork a gist
  • Save nnja/caeb2ffeb407debca3bde5f875996804 to your computer and use it in GitHub Desktop.
Save nnja/caeb2ffeb407debca3bde5f875996804 to your computer and use it in GitHub Desktop.
Configure git editor

Set which editor git should use.

This is the program that will open during a commit with no -m flag, a merge, a rebase, etc...

Select from any installed editor. Examples:

  • emacs: emacs
  • vi: vi or vim
  • atom: atom --wait
  • sublime: subl -n -w
  • vscode: code --wait

Run: $ $ git config --global core.editor <YOUR_EDITOR>

@flkc
Copy link

flkc commented Feb 11, 2018

hey @nnja, you can update your gist from my fork.

@jdkahn
Copy link

jdkahn commented Nov 17, 2018

The vscode settings above are not enough. You need to edit the config directly and set the path to the application. See this stackoverflow. https://stackoverflow.com/a/35782566/2066978

@forethoughtde
Copy link

@jdkahn you are right! vscode does not work with the above setting.

@mjlyons
Copy link

mjlyons commented Jun 21, 2019

@nnja I think you need quotes around <YOUR_EDITOR> (at least I did for vscode):

$ git config --global core.editor "code --wait"

@sandro-git
Copy link

@mjlyons you're right thanks

@AngieCristina
Copy link

;) Thank you guys

@vucurovicmarko
Copy link

  • PhpStorm: webstorm -w

@krzysiekpiasecki
Copy link

@jdkahn If you're installed vscode with an executable on the path, you don't have to set full path to vscode in git config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment