git diff 中文乱码
时间: 2023-10-20 17:31:05 浏览: 283
在使用git diff命令时,如果文件名是以gb2312格式编写的,而git diff接受的编码格式为utf-8,就会导致git diff显示中文乱码。这个问题也会出现在对前后两次commit版本进行差异化对比时,中文名的文件也会显示为乱码。
原因是git diff的输出使用了less,而less不支持gbk编码。为了解决这个问题,我们可以将git diff的输出放到一个支持gbk编码的编辑器中,这样就可以正确显示中文。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [git diff获取差异文件名显示中文乱码的解决办法](https://blog.csdn.net/hanlizhong85/article/details/80642571)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *3* [Git Diff中文乱码问题 (windows git bash)](https://blog.csdn.net/qhexin/article/details/107848679)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文