如何停止git add -patch不显示提示

Jam*_*son 9 git cygwin patch add mintty

git add --patch somefile.txt在cygwin中使用时,我得到了一个奇怪的回应.

在第一次输入命令后,它等待我点击enter而不显示任何内容.按下后,enter我得到以下输出

--- a/somefile.txt
+++ b/somefile.txt  
@@ -m,n +m,n @@
-Aple
+Apple
 Bear
 Cat
 Dog

Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? y - stage this hunk
n - do not stage this hunk
q - quit; do not stage this hunk nor any of the remaining ones
a - stage this hunk and all later hunks in the file
d - do not stage this hunk nor any of the later hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk un
Run Code Online (Sandbox Code Playgroud)

然后留下克拉 un

做出选择后,在这种情况下,n我得到了其余的

J - leave this hunk unn
decided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help
@@ -1,4 +1,4 @@
-Lne 1
+Line 1
 Line 2
 Line 3
 Line 4
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? @@ -289,6 +289,8 @@
 Line 289
 Line 290
 Line 291
+Line 292
+Line 293
 Line 294
 Line 295
 Line 296
Run Code Online (Sandbox Code Playgroud)

对于文件的其余部分,模式继续,让我无法分辨出我被提示的块.

Von*_*onC 6

当git与Cygwin一起使用时,我通常会看到两个设置.

第一个(如果你git config -l还没有包含它)是关于寻呼机(如在这个gitconfig文件中)

git config core.pager C:/cygwin/root/bin/less.exe

[core]
        # we want to use cygwin's less, because msys's doesn't play well
        # with i/o via cygwin bash. This would be the default, but for the fact
        # that msysgit prepends `dirname argv[0]` to $PATH.
        pager = C:/cygwin/root/bin/less.exe
Run Code Online (Sandbox Code Playgroud)

另一个是关于TTY,如在这篇博文中:

export TERM=cygwin
export LESS=FRSX
Run Code Online (Sandbox Code Playgroud)

其中一个设置应该使您的git add -p运行更顺畅.


Jam*_*son 1

考虑到票数,这已经收到了,看来我不是唯一一个有这个问题的人。

Cygwin 的默认安装似乎不包括 git。但是,如果您单独安装了 git,它将被添加到您的 Windows 路径中,并且在其他方​​面都可以正常工作。

IE

> which git
c:\Program Files (x86)\Git\bin\git
Run Code Online (Sandbox Code Playgroud)

一旦我通过 Cygwin 安装了 git 并使用该版本,问题就解决了

IE

> which git
/usr/bin/git
Run Code Online (Sandbox Code Playgroud)