简体   繁体   中英

Configure git to always show absolute paths

How to configure git to always show absolute paths?

Example for git status -uno :

Actual behavior (relevant paths):

    new file:   xxx/xxx.c

Wanted behavior (absolute paths):

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

I don't think you can get git status to show absolute paths, but you can configure it to show paths relative to the git root, see man git-status for details:

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

And

~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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM