using Notepad++ for git inside cygwin

This is an extension of this question

How do I use Notepad++ (or other) with msysgit?

  • How to stop git add -patch not displaying prompt in mintty
  • cygwin git thinks that file previously had different mode
  • Running Git through Cygwin from Windows
  • Git Extensions: Win32 error 487: Couldn't reserve space for cygwin's heap, Win32 error 0
  • Git difftool ridiculously slow in Cygwin/MinGW
  • Why git under cygwin asks for password?
  • i have done all combinations that i can think of for my shell script. when i have my cygwin console (im using mintty if it matters) i can type

    npp {file}

    and the file opens correctly. but when i do a

    git rebase -i HEAD~5

    npp opens with a blank new document, not the interactive file to control the rebase. any idea why this would be happening?

    git --version
    git version 1.7.9

    latest version of cygwin on a windows 7 machine and NPP 5.9.8

    also, here is my wrapper script

    "C:/Program Files (x86)/Notepad++/notepad++.exe" -multiInst -notabbar \
      -nosession -noPlugin "$*"

  • How to generate stats for a GitHub project?
  • How to conclude your merge of a file?
  • How can I trigger garbage collection on a Git remote repository?
  • Merge and delete branch in one step/command
  • Un-stage file with libgit2
  • Github: Import upstream branch into fork
  • 4 Solutions collect form web for “using Notepad++ for git inside cygwin”

    I was correct about my cygwin path issue. i changed my shell wrapper to this

    'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar \
      -nosession -noPlugin "$(cygpath -w "$*")"

    and it worked perfectly.

    Here is the complete solution without a wrapper script.

    These lines assume that you are using the 64bit version of Windows.

    Run the following command from the command prompt (Cygwin):

    git config --global core.editor \
      "'$(cygpath -u "C:\Program Files (x86)\Notepad++\notepad++.exe")' \
      -multiInst -notabbar -nosession -noPlugin"

    This is an example of how your .gitconfig should look like after the command:

        excludesfile = /home/Aternus/.gitignore_global
        autocrlf = input
        safecrlf = true
        editor = '/cygdrive/c/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar -nosession -noPlugin

    I’ve created a simple script for running arbitrary Windows commands with UNIX-style path arguments:

    if test -z "$1"; then
        echo "Usage: $(basename "$0" .sh) program [argument]..."
        exit 1
    if test $# -ge 0; then
        exec "$program" $(cygpath -w "$@")
        exec "$program"

    Here’s how I can use it in my git config (assuming cygrun is a symlink to somewhere in PATH):

        editor = cygrun 'C:/Program Files/Notepad2/Notepad2.exe'
    [difftool "diffmerge"]
        cmd = cygrun 'C:/Program Files/SourceGear/Common/DiffMerge/sgdm.exe' \"$LOCAL\" \"$REMOTE\"

    This way one script can fits many similar use cases, there’s no need to create a separate wrapper every time. It can be convenient to use from command line as well.

    #!/bin/dash -e
    if [ "$1" ]
    then k=$(cygpath -w "$1")
    elif [ "$#" != 0 ]
    then k=
    Notepad2 ${k+"$k"}
    1. If no path, pass no path

    2. If path is empty, pass empty path

    3. If path is not empty, convert to Windows format.

    Then I set these variables:

    export GIT_EDITOR='dash /usr/local/bin/'
    1. EDITOR allows script to work with Git

    2. GIT_EDITOR allows script to work with Hub commands


    Git Baby is a git and github fan, let's start git clone.