为什么特定repo的git状态返回相对于root而不是当前目录的路径?

时间:2013-04-03 18:26:37

标签: macos git

当从特定仓库中的子目录使用git时,相对于根返回文件的路径,就像这样

cd $REPO_ROOT/subdir
git status
...
#   modified ../subdir/file.txt

此行为是最近的,它用于返回file.txt,就像我的其他git repos一样,并且它正在弄乱其他功能,来自子目录的git blame file.txt将每行返回为{{1 ,获取我需要使用Not Yet committed的实际输出。这也搞乱了vim git插件,所以我很生气。

我已经运行../subdir/file.txt,但问题仍然存在。

编辑:添加git版本和配置

git gc

1 个答案:

答案 0 :(得分:4)

这是一个配置问题:

cd repo
git config status.relativePaths true

或全球:

git config --global status.relativePaths true

进一步阅读:https://www.kernel.org/pub/software/scm/git/docs/git-status.html