【发布时间】:2021-05-20 09:12:53
【问题描述】:
如何配置 git 始终显示绝对路径?
git status -uno 的示例:
实际行为(相关路径):
new file: xxx/xxx.c
想要的行为(绝对路径):
new file: /home/zzz/xxx/xxx.c
【问题讨论】:
如何配置 git 始终显示绝对路径?
git status -uno 的示例:
实际行为(相关路径):
new file: xxx/xxx.c
想要的行为(绝对路径):
new file: /home/zzz/xxx/xxx.c
【问题讨论】:
我认为你不能让git status 显示绝对路径,但你可以将其配置为显示相对于 git 根目录的路径,详情请参阅man git-status:
如果配置变量
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)
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
【讨论】:
show absolute paths 功能在git 中有用吗?