Windows git bash display in Chinese

Source: Internet
Author: User

1, C:\Program Files\git\etc\git-completion.bash:

Alias ls= ' ls--show-control-chars--color=auto '

Description: Allows you to enter the LS command in Git Bash to display the Chinese file name correctly.

2, C:\Program FILES\GIT\ETC\INPUTRC:

Set Output-meta on

Set Convert-meta off

Description: Allows you to enter Chinese in Git Bash, such as a commit log in Chinese.

3, C:\Program Files\git\etc\profile:

Export Lesscharset=utf-8

Description: $ git log command Unlike other VCs, n log rolls over to the end, it will properly stop on the first page, press space key and then page back. This is accomplished by sending the log to less processing. The above is to set the less character encoding so that the $ git log can display Chinese correctly. In fact, its value is not necessarily set to utf-8, such as latin1 can also .... There is also a way to $ git–no-pager log, in the option to prohibit paging, you do not need to set the above options.

4, C:\Program Files\git\etc\gitconfig:

[GUI]

encoding = Utf-8

Description: Our code base is a unified utf-8, so setup can display the Chinese in the code normally in the Git GUI.

[i18n]

commitencoding = GB2312

Description: If this is not the case, although we use the $ git log to see their Chinese revision is no problem, but, one, our log pushed to the server will become garbled; second, the other people in Linux push the Chinese log after we pull came to look garbled. This is because our commit log is stored first in the project's. git/commit_editmsg file, and in Chinese Windows, the new file is encoded with GB2312, but Git doesn't know that the default utf-8 is sent out, so it's garbled. 。 With this, Git converts it to Utf-8 first, then sends it out, so there's no problem.

You can set git defaults to another editor:

$ git config--global core.editor "notepad"

Where notepad can be replaced with better WordPad, notepad++, etc. (although they cannot be accessed directly from the command line, you must set the PATH variable first).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.