Archive for the ‘git’ Category
Git core.editor for Windows
I’m using Windows 7. Here I’ll provide some steps of how to set up an editor to work with Git on Windows.
Step 1. Check what editor is set up at the moment.
git config --global --get core.editor |
Probably, you’ll get an empty value. Notice, that --global
parameter points to your current user .gitconfig
file.
Step 2. Edit your PATH
variable.
Now, it’s time to edit an environment variable PATH
. To do that open System Properties
dialog / Advanced
tab / Environment Variables...
/ System variables
/ PATH
. Edit PATH
variable and specify where to find an editor’s binary file. I use Notepad++ so in my case I specify a path to it.
%SystemRoot%\system32;%SystemRoot%;.....;C:\Program Files (x86)\Notepad++\ |
Step 3. Set up git core.editor.
To check that you can run your editor by specify only its name without specifying a path press Windows+R
and type notepad++
, or your editor’s name. An editor should be opened.
Let’s set up this editor to use it with git.
git config --global core.editor notepad++ |
Notepad++ factor
In my case, there was a problem with Notepad++. For example, you already have some opened tabs in Notepad++ and you’re working on some text files. When you’re trying to commit without a message, Git opens a text file in a new tab of Notepad++ and waits when you will close the text editor’s window. I don’t want to close the window with other tabs where I edit some other text files. To solve this problem set your text editor as follows:
git config --global core.editor "notepad++.exe -multiInst" |
By specifying -multiInst you tell Notepad++ to open new instance of editor. Before I set this options I got “Aborting commit due to empty comment message” when Notepad++ was opened and I was trying to make a commit.
Also, it’ll be more comfortable if you set these options:
git config --global core.editor "notepad++ -multiInst -nosession -noPlugin -notabbar" |
If you are interested in what these options do follow this .
How to test: if you are committing some changes without a comment git commit
, your text editor will be shown to specify a comment.
P.S. This approach works when you use cmd.exe
, Far
or something else that uses Windows environment. This won’t work if you use Git Bash.