Using 'diff' (or anything else) to get character-level diff between text files

前端 未结 15 2227
借酒劲吻你
借酒劲吻你 2020-12-02 05:40

I\'d like to use \'diff\' to get a both line difference between and character difference. For example, consider:

File 1

abcde
ab         


        
15条回答
  •  伪装坚强ぢ
    2020-12-02 06:30

    If you keep your files in Git, you can diff between versions with the diff-highlight script, which will show different lines, with differences highlighted.

    Unfortunately it only works when the number of lines removed matches the number of lines added - there is stub code for when lines don't match, so presumably this could be fixed in the future.

提交回复
热议问题