Reputation: 527
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.
Upvotes: 2
Views: 2110
Reputation: 4253
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.
Upvotes: 3