美文网首页
Android Studio git log 乱码解决方案

Android Studio git log 乱码解决方案

作者: Sophia_dd35 | 来源:发表于2020-05-15 14:09 被阅读0次

    一、问题描述

    提交代码之后,commit message 中存在中文备注;在使用git log查看代码历史记录的时候发现commit message乱码: image.png

    二、解决方案

    for Mac

    到Git Bash命令窗口输入如下设置命令语句
    git config --global i18n.commitencoding utf-8  --注释:该命令表示提交命令的时候使用utf-8编码集提交
    
    git config --global i18n.logoutputencoding utf-8 --注释:该命令表示日志输出时使用utf-8编码集显示
    
    export LESSCHARSET=utf-8  --注释:设置LESS字符集为utf-8
    
    

    for windows

    到Git Bash命令窗口输入如下设置命令语句
    git config --global i18n.commitencoding utf-8  --注释:该命令表示提交命令的时候使用utf-8编码集提交
    
    git config --global i18n.logoutputencoding utf-8 --注释:该命令表示日志输出时使用utf-8编码集显示
    
    set LESSCHARSET=utf-8  --注释:设置LESS字符集为utf-8
    

    设置完成后,使用git log,发现之前提交代码的中文注释就不再乱码了。

    相关文章

      网友评论

          本文标题:Android Studio git log 乱码解决方案

          本文链接:https://www.haomeiwen.com/subject/ijjcohtx.html