using Notepad++ for git inside cygwin

This is an extension of this question

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

  • How to set system default line ending to CRLF mode for git in Cygwin?
  • Git - Authentication failed
  • Truly Portable Git
  • Git,ssh,Cygwin and folders outside of Cygdrive install folders
  • git push using PuTTY on Windows fails (fatal: The remote end hung up unexpectedly)
  • git without bash/cygwin
  • 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 "$*"

  • Foundation project creation fails with npm ERR! git rev-list on debian 8.5.0
  • Get the “Pull Request Name” from a file/line
  • Check if there are changes under <path> since <commit-ish>
  • Migration from SVN to GIT, suggest, please, repository structure
  • Can I get git fsck to show commit names?
  • Version Control: multiple version hell, file synchronization
  • 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.