简体   繁体   中英

git status: use absolute paths instead of relative

When I do git status , it shows files with relative paths:

modified:   foo
modified:   ../../etc/hosts

Relative paths are more unclear than absolute paths. I have to mentally retrace the path to see where the file is located.

How can I tell git to use absolute paths?

modified:   foo
modified:   /etc/hosts

UPDATE

As suggested by @LightBender, I have set relativePaths = false in my .gitconfig :

[status]
    howUntrackedFiles = all
    relativePaths = false

However, this has no effect. git status still shows relative paths as before.

As mentioned in the configuration section of the documentation for git-status:

You can set the configuration value status.relativePaths to false and git will display the paths relative to the project root (not the system root).

git config [--global|local] status.relativePaths true

As a side note, I tried this once and almost immediately got annoyed with having to constantly either type the magic signature for the project root ( :/ ) at the start of every path or having to figure out which part I needed to use the path relatively in a command. Having git always present me with the path I need to use the file in a git command turned out to be preferable to me.

不确定,但你可以试试

git status --porcelain

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