2013-12-18 26 views
9

當在cygwin中使用git add --patch somefile.txt時,我得到了一個奇怪的迴應。如何停止git add -patch不顯示提示mintty

第一次輸入命令後,它等待我點擊輸入而不顯示任何內容。有一次,我按進入我得到以下輸出

--- 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 

而離開後un

克拉我得到了休息

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 

模式進行選擇,在這種情況下n後繼續爲文件的其餘部分留下我無法分辨哪些大塊我被提示。

回答

1

鑑於票數,這已收到它看起來像我不是唯一一個這個問題。

似乎Cygwin的默認安裝不包含git。但是,如果你已經單獨安裝了git,它將被添加到你的windows路徑中,並且看起來可以在其他任何方面工作。

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

一旦我通過Cygwin的安裝Git和使用該版本的問題解決了

> which git 
/usr/bin/git 
6

我通常會在Cygwin中使用git時看到兩個設置。

第一個(如果你的git config -l不已經包括它)大約是尋呼機(如本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 

其他都是關於TTY,如this blog post

export TERM=cygwin 
export LESS=FRSX 

其中一個設置應該會使git add -p運行更平穩。

+0

唉沒有這些作品中,我認爲它是與輸入和輸出流被使用的方式 –

+0

我已經將這個答案授予賞金,因爲它是唯一的答案,賞金即將到期。但是,這些設置對我的機器沒有任何影響。 –