James Robinson James Robinson - 10 months ago 45
Git Question

How to stop git add -patch not displaying prompt in mintty

When using

git add --patch somefile.txt
in cygwin I get a bizarre response.

After first typing the command it waits for me to hit enter without displaying anything. Once I press enter I get the following output

--- a/somefile.txt
+++ b/somefile.txt
@@ -m,n +m,n @@

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

And leaves the carat after

After making a selection , in this case
I get the rest

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

The pattern continues for the rest of the file leaving me unable to tell which hunk I am being prompted on.

Answer Source

Given the number of votes, this has received it looks like I am not the only one with this problem.

It would seem that the default install of Cygwin does not include git. However, if you have installed git separately, it will have been added to your windows path and will appear to work in every other regard.


> which git
c:\Program Files (x86)\Git\bin\git

Once I installed git through Cygwin and used that version the problem was solved


> which git