The article is on the wiki, check it out if you have a minute and see what you think.

I love the flexibilty that git provides, and the way it fits into distributed development.  That’s the only reason I’ve been able to tolerate the hackery that is known as msysgit, the “official” Git release for Windows.

msysgit basically dumps an entire linux distribution on your Windows box when you install – ported versions of perl, vim, bash, it’s all there, just to wipe msysgit’s butt.  What a mess.  Imagine if every port was done this way.  But we’re stuck with it for now, so let’s get it working.  Which.  Isn’t.  Easy.  Especially when it comes to setting up an editor for commit messages when using a batch file script.

There are alternatives.  You can right-click on a folder and run a “Git Bash” from that location, which is hacked together to work well enough.  VIM will kick in to let you edit your commit messages.  And there are writeups on getting Windows Powershell to get along with msysgit.  But I want to use git from simple Windows batch files.

To do so, I had to do the following:

  • Install notepad++, a nice reliable simple Windows editor.
  • Set up a batch file to run notepad++ – make sure that the batch file does not have any spaces in the path to it – I named mine [c:\short\npp.bat]:
    #!/bin/sh
    "C:/Michae~1/System~1/npp/notepad++.exe" -multiInst "$*"
  • Note that I used short names in the notepad++ path to avoid spaces.  I also found that a single quote in the path will screw up msysgit.
  • Now in a batch file, you should be able to set EDITOR to use it:
    set EDITOR=C:/short/npp.bat
    git commit -a
  • You can now set the editor up for use in the msysgit bash prompt as follows, it doesn’t seem to interfere with the batch setup (for SOME strange reason):
    git config --global core.editor C:/short/npp.bat

Without ALL of these steps, it just won’t work.

My git wiki article has been updated. Humming along. If this looks like something you want to do, check it out…

                      repo1
               mybranch<->master
              /                 \
my shared repo                   external svn repo
              \                 /
               mybranch<->master
                      repo2