Skip to content

Instantly share code, notes, and snippets.

@isqua
Last active October 14, 2023 14:23
Show Gist options
  • Save isqua/fcafd18019b5ce61e3de31c567d7202b to your computer and use it in GitHub Desktop.
Save isqua/fcafd18019b5ce61e3de31c567d7202b to your computer and use it in GitHub Desktop.

Set up git editor

The main command is:

git config --global core.editor "path to your editor with params"

Set up an editor and check it by making a commit:

git commit --allow-empty

Your favourite editor should open. Write commit message, save and close file. See git log to look for a commit. Is it there? If yes, you’re awesome.

Windows, VS Code

Make sure you selected ‘Add to PATH’ during the installation.

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

Windows, Atom

git config --global core.editor "atom --new-window --foreground --wait"

Windows, Sublime Text 3

 git config --global core.editor "'c:/program files/sublime text 3/subl.exe' -w"

Windows, Notepad++

git config --global core.editor "'C:/Program Files/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin"

macOS, VS Code

Select Shell Command: Install 'Code' command in path from the Command Palette. Then run:

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

macOS, TextEdit

git config --global core.editor "open -W -n"

macOS, Atom

git config --global core.editor "atom --wait"

macOS, Sublime Text 3

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
git config --global core.editor "subl -n -w"

or

git config --global core.editor '"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" -n -w'
@isqua
Copy link
Author

isqua commented Apr 26, 2020

@aengorg Thank your for suggestion!

@AnrDaemon
Copy link

Windows - Far manager

Far.exe -co -e0:0

In case you have enabled saving of edited file position, 0:0 parameters to -e switch will reset the position to column 0, row 0 (i.e. the beginning of the document, what we usually want with commit message editor).
-co (load cached plugins only) is recommended for performance purposes. Far won't rescan the plugins directory, thus saving what little time it could.

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