2012-05-07 21 views

cevap

29

Kullanım --word-diff-regex:

--word-diff-regex=<regex> 
     Use <regex> to decide what a word is, instead of considering runs 
     of non-whitespace to be a word. Also implies --word-diff unless it 
     was already enabled. 

     Every non-overlapping match of the <regex> is considered a word. 
     Anything between these matches is considered whitespace and 
     ignored(!) for the purposes of finding differences. You may want to 
     append |[^[:space:]] to your regular expression to make sure that 
     it matches all non-whitespace characters. A match that contains a 
     newline is silently truncated(!) at the newline. 

     The regex can also be set via a diff driver or configuration 
     option, see gitattributes(1) or git-config(1). Giving it explicitly 
     overrides any diff driver or configuration setting. Diff drivers 
     override configuration settings. 

asla kullanılmış ama git diff --word-diff-regex="[^[:space:],]+" çalışabilir sanırım.

+0

It does beni Regex her zaman belirtmek zorunda ziyade ben --word-diff belirtirken, varsayılan olarak bu regex kullanımı, git config ayarlamak konusunda bir fikrin – oberlies

+0

:-) çalışma . – sibaz

+1

Kendi sorumu yanıtladı: 'git config --global diff.wordRegex [^ [: space:],] +' – sibaz

1

-w/--ignore-all-space'u da deneyebilirsiniz, ancak bu, istediğinizden daha fazla boşluk göz ardı edebilir.

+0

-b'yi biraz daha az boşlukla yok sayar. –

9

KurzedMetal'in cevabına ek olarak: tırnak işaretleri olmadan, TAB'a basarken bashs otomatik tamamlama işlemimi bozmadığından daha iyi çalışır.

git diff --word-diff-regex=[^[:space:],]+

İlgili konular