配置 git 以始终显示绝对路径

Configure git to always show absolute paths

如何配置 git 以始终显示绝对路径?

git status -uno 示例:

实际行为(相关路径):

    new file:   xxx/xxx.c

想要的行为(绝对路径):

    new file:   /home/zzz/xxx/xxx.c

我认为您无法让 git status 显示绝对路径,但您可以将其配置为显示相对于 git 根目录的路径,详情请参阅 man git-status

If the config variable status.relativePaths is set to false, then all paths shown are relative to the repository root, not to the current directory.

~repo/src $ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    a.txt

~repo/src $ git config --global status.relativePaths false
~repo/src $ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    src/a.txt