Hin*_*ton 8 c++ git pretty-print indentation git-diff
有没有办法让Git indent/美化/漂亮打印两个版本的C++源文件,然后再进行区分?
我不希望Git向我展示在有人自动格式化代码之后引入的无数更改.
示例用法:在缩进git difftool --indent-before-diffing path/to/file原始版本path/to/file和修改版本后,我点击并获取更改path/to/file.
161*_*903 11
如果您可以找到为您缩进的应用程序,则可以使用此处描述的方法来处理odt文件:
将以下行添加到.gitattributes文件中:
*.odt diff=odt现在在.git/config中设置odt diff过滤器:
Run Code Online (Sandbox Code Playgroud)[diff "odt"] binary = true textconv = /usr/local/bin/odt-to-txt
所以对于C++文件,它将是这样的:
*.cpp diff=cpp
Run Code Online (Sandbox Code Playgroud)
在.git/config中:
[diff "cpp"]
binary = true
textconv = /path/to/indenter
Run Code Online (Sandbox Code Playgroud)
正如评论中指出的,GNU Indent可用于缩进.
| 归档时间: |
|
| 查看次数: |
4444 次 |
| 最近记录: |