2

当从特定仓库中的子目录使用 git 时,文件的路径将相对于根目录返回,如下所示

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

这种行为是最近的,它过去常常返回file.txt,就像我的其他 git repos 一样,它弄乱了其他功能,git blame file.txt从子目录返回每一行作为Not Yet committed,以获得我需要使用的实际输出../subdir/file.txt。这也弄乱了 vim git 插件,所以我很生气。

我已经跑git gc了,但问题仍然存在。

编辑:添加 git 版本和配置

git version 1.7.4.4

user.name=...
user.email=...
github.user=...
color.branch=auto
color.diff=auto
color.status=auto
color.branch.current=yellow reverse
color.branch.local=yellow
color.branch.remote=green
color.diff.meta=yellow bold
color.diff.frag=magenta bold
color.diff.old=red
color.diff.new=green
color.status.added=green
color.status.changed=red
color.status.untracked=cyan

core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
core.ignorecase=true

#remotes and branches 

status.relativepaths=true
4

1 回答 1

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

于 2013-04-03T18:53:44.647 回答