Mac M系列 git branch 中文亂碼
git branc 中文名字過長顯示亂碼問題
例如顯示如下
git:(feature/測試-****)
查看 git 版本 git -v
? ~ git -v
git version 2.39.3 (Apple Git-146)
發(fā)現(xiàn)是Xcode 內(nèi)置 git版本是 2.39.x 導致2.40.x 已經(jīng)修復
* sscanf(3) used in "git symbolic-ref --short" implementation found
to be not working reliably on macOS in UTF-8 locales. Rewrite the
code to avoid sscanf() altogether to work it around.
(merge 613bef56b8 jk/shorten-unambiguous-ref-wo-sscanf later to maint).
如果不想升級 git 可以按照以下方式切使用 oh-my-zsh
修改 oh-my-zsh
代碼,去掉 --short
參數(shù)蕉陋,把symbolic-ref --short
改為 symbolic-ref
主要在lib/git.zsh
和 lib/cli.zsh
更改就行
升級git 解決
brew install git
# 安裝成功后執(zhí)行
brew info git
顯示如下
==> git: stable 2.45.2 (bottled), HEAD
Distributed revision control system
https://git-scm.com
Installed
/opt/homebrew/Cellar/git/2.45.2 (1,664 files, 51.5MB) *
Poured from bottle using the formulae.brew.sh API on 2024-07-05 at 10:34:35
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/git.rb
License: GPL-2.0-only
==> Dependencies
Required: gettext ?, pcre2 ?
==> Options
--HEAD
Install HEAD version
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.
zsh completions and functions have been installed to:
/opt/homebrew/share/zsh/site-functions
==> Analytics
install: 128,337 (30 days), 436,727 (90 days), 1,516,995 (365 days)
install-on-request: 125,830
如果想在當前查看
exec zsh
# 然后執(zhí)行一下命令
git --version
## 版本如下
git version 2.45.2
然后就搞定了就可以全部展示出來了