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 @@
-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
And leaves the carat after un
After making a selection , in this case n
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.
To interrupt the current command press CTRL-C . If the bottom-left of your shell window shows --More-- you are viewing a file using more . To exit from more press q . If the bottom-left of your shell window shows filename , : or (END) you are viewing a file using less .
Clicking the window's close button, pressing Alt+F4, or choosing Close from the window menu sends a SIGHUP signal to the process running in mintty, which normally causes it to exit.
If you are familiar with the Linux command line, then choose the MinTTY terminal emulator. If you are not, then you may consider using Windows' default console window. Note that Windows' console window has some limitations including fixed width, limited scrollback, and Non-ASCII characters configuration.
MinTTY is the terminal emulator that comes by default with Git for Windows. It has known issues with gh's ability to prompt a user for input. There are a few workarounds to make gh work with MinTTY: Reinstall Git for Windows, checking "Enable experimental support for pseudo consoles".
I usually see two settings when using git with Cygwin.
The first one (if your git config -l
don't already include it) is about the pager (as in this gitconfig
file)
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
The other are about the TTY, as in this blog post:
export TERM=cygwin
export LESS=FRSX
One of those settings should make your git add -p
runs more smoothly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With