Last Updated: 03/05/2011 11:39:00 AM

GIT: using a different text editor from command line (Win 7)

GIT: using a different text editor from command line (Win 7)

By default Git uses VIM as its text editor. Lots of people love VIM.  I however just can't seem to memorize all the arcane keyboard shortcuts, :x to save? Really?

Note: you can use ANY editor to modify your code, I am not talking about your code editor.  What I am talking about is what GIT uses when it needs to present more info than just the command line.  For instance  at the git bash type

git commit

since you didn't supply a commit message this will pop-up:

VIM

 Obviously this person is clueless. They are using php ;)

 

To change this in Windows 7, you need to do two things:

1. Create a .bat file that calls the text editor of your choice (in my case notepad++)

2. Update Git's global config to use the .bat file

 

Create a bat file called c:\prog\npp.bat that contains:

 

#!/bin/sh
"C:\Program Files (x86)\Notepad++\notepad++.exe" -multiInst "$*"

 

 

Finally in git bash command line type: 

 

 

 

Now when you type git commit you will get notepadd++ to create your SUPER CREATIVE commit message:

 

Good Stuff!