我的 daily system 使用 git 的時候,會有中文檔名顯示的問題,看起來像是:
[1] 不太確定有沒有關聯,但先記下我當時的系統語言環境變數是
[2] 查詢 git-config 使用手冊
$ git diff
diff --git "a/\346\210\221" "b/\346\210\221"
index f13588b..75050e9 100644
--- "a/\346\210\221"
+++ "b/\346\210\221"
@@ -1 +1,4 @@
asdfasdf
+22222222
可以用下面的指令解決這個問題[2]:
git config core.quotepath false
原本上面的亂碼看起來就會是:
$ git diff也就是說中文檔名「我」現在被正確顯示了。
diff --git a/我 b/我
index f13588b..75050e9 100644
--- a/我
+++ b/我
@@ -1 +1,4 @@
asdfasdf
+22222222
[1] 不太確定有沒有關聯,但先記下我當時的系統語言環境變數是
$echo $LANG
en_US.UTF-8
[2] 查詢 git-config 使用手冊
man 1 git-config
core.quotePath
The commands that output paths (e.g. ls-files, diff), when not given the -z option, will quote "unusual" characters in the pathname by enclosing the pathname in a double-quote pair and with backslashes the same way strings in C source code are quoted. If this variable is set to false, the bytes higher than 0x80 are not quoted but output as verbatim. Note that double quote, backslash and control characters are always quoted without -z regardless of the setting of this variable.