2017-04-26 30 views
0

在編寫Markdown(文章,報告,文檔等)時,在差異時使用--word-diff標誌更有用。使Git自動在Markdown文件中使用--word-diff

沒有--word-diff我們可以看到變化的整條生產線的價值:

-Luckily, Git commit templates are incredibly simple to set up. Start by creating 
+Luckily, Git commit templates are relatively simple to set up. Start by creating 

而且隨着--word-diff我們看到只有[-incredibly-]{+relatively+}已經改變:

Luckily, Git commit templates are [-incredibly-]{+relatively+} simple to set up. Start by creating 

我真的喜歡GIT中自動使用--word-diff當它知道我在區分Markdown文檔時:是否有可能?我已經開始鬆散地閱讀Git Attributes,但沒有快樂。

乾杯!

+0

可能重複[如何爲\ *。tex文件自動使用git diff --word-diff選項而不是別人?](http://stackoverflow.com/questions/36368060/how-to-automatically-use -git-diff-word-diff-option-for-tex-files-but-not -oth) –

回答

0

在命令行中似乎沒有簡單的方法來完成此操作,但可以將該參數添加到命令中,或者在項目中或在全局中設置--word-diff配置。我在〜/的.gitconfig別名:

[alias] 
    df = diff --patch-with-stat --word-diff --find-renames 
    dfs = diff --staged --patch-with-stat --word-diff --find-renames 
    # more aliases 

也有一個答案How to automatically use git diff --word-diff option for *.tex files but not others? whic有關。

+0

我不害怕。嘗試了'./。gitattributes'和'.git/info/attributes'(並嘗試設置一個全局的'〜/ .gitattributes'文件)無濟於事:(這是你之前工作的東西嗎?在實際上是否有可能?謝謝:) – csswizardry

+0

道歉 - 即引用配置的另一部分稱爲「字」,即MSword的過濾器。 –