How can I set up an editor to work with Git on Windows?

后端 未结 30 1335
悲哀的现实
悲哀的现实 2020-11-22 13:57

I\'m trying out Git on Windows. I got to the point of trying \"git commit\" and I got this error:

Terminal is dumb but no VISUAL nor

30条回答
  •  半阙折子戏
    2020-11-22 14:07

    Here is a solution with Cygwin:

    #!/bin/dash -e
    if [ "$1" ]
    then k=$(cygpath -w "$1")
    elif [ "$#" != 0 ]
    then k=
    fi
    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 EDITOR=notepad2.sh
    export GIT_EDITOR='dash /usr/local/bin/notepad2.sh'
    
    1. EDITOR allows script to work with Git

    2. GIT_EDITOR allows script to work with Hub commands

    Source

提交回复
热议问题