search

Home  >  Q&A  >  body text

I've been doing it all afternoon and I'm going to die. Git log garbled problem, solve T T

I have tried all the methods in it and searched through Baidu and Google. https://my.oschina.net/lujian...

怪我咯怪我咯2844 days ago600

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-05-02 09:51:50

    I don’t know the specific reason, but I have encountered similar situations before. I may have some experiences that you can refer to:

    1. Don’t use git on msys or cygwin, use the official git one. Because the git on cygwin thinks it is a Linux environment, the default encoding is UTF, and Windows does not use UTF, so when adding, it will not be recognized as Windows and will not be transcoded for you, resulting in garbled code.

    2. If there is an encoding problem, do not try to modify the default configuration first, but refer to 1

    3. Do not copy git repositories of different platforms directly. Git itself has done a lot of compatibility work, such as line endings. If you copy it directly, git will not be able to modify the line endings, and then when you git status, you will find that all files have changed.

    Well, if you use the official git again and the default encoding configuration, there will probably be no problems.

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-02 09:51:50

    Show you what I used git bash 的配置吧,不知道哪一句的作用
    commitencoding提交和保存在版本库里 log 的编码,如果你不知道保存在库实际的编码那就没办法了。
    logoutputencoding 应该是交给shell时候使用的编码,如果不相同应该会进行转换。
    gui.encoding 似乎是设置git bash 使用的编码,这个要和logoutputencoding,我都设置成utf-8.

    [i18n]
        commitencoding = utf-8
        logoutputencoding = utf-8
    [gui]
        encoding = utf-8
    [core]
        quotepath = false
    [i18n "commit"]
        encoding = utf-8

    reply
    0
  • Cancelreply