gpt4 book ai didi

git - 文件被列为前缀为 ../in git

转载 作者:太空狗 更新时间:2023-10-29 14:20:01 26 4
gpt4 key购买 nike

我有一个问题:当我从一个目录运行 git status 时,它将该目录的许多文件列为 ../../../file这实际上是我当前目录中没有任何父文件夹前缀的文件。

repo 在 D:/.git 中,我当前的目录是 /d/anurag/work/sources/webhosting/gij-sync-scripts 我使用 git-bash 命令 shell。我的是 git 1.8.3.msysgit.o 版本。

我从来没有用这种方式添加过文件。是什么原因造成的? enter image description here

这是我粘贴的文本版本(如上图所示):

> D14@D14-PC /d/anurag/work/sources/webhosting/gij-sync-scripts (master)
> $ git commit
> # On branch master
> # Changes not staged for commit:
> # (use "git add <file>..." to update what will be committed)
> # (use "git checkout -- <file>..." to discard changes in working directory)
> #
> # modified: ../../../../../Anurag/work/sources/webhosting/gij-sync-scripts/copy-site-files.pl
> # modified: ../../../../../Anurag/work/sources/webhosting/gij-sync-scripts/local-common.pl
> # modified: backup-gij.pl
> # modified: backup-joi.pl
> # modified: backup-nav.pl
> # modified: backupall.sh
> # modified: restoreall.sh
> #
> # Untracked files:
> # (use "git add <file>..." to include in what will be committed)
> #
> # ../../../../../.gitignore
> # ../../../../../5632_20269334_MVM_7.tmp
> # ../../../../../Anurag/work/admissioncourses.com/
> # ../../../../../Anurag/work/govtjobsindia/
> # ../../../../../Anurag/work/indiadiscountoffers.com/
> # ../../../../../Anurag/work/jobsopeningindia.com/
> # ../../../../../Anurag/work/sources/bookrailticket/.buildpath
> # ../../../../../Anurag/work/sources/bookrailticket/.cvsignore

我运行此命令的当前目录是 /d/anurag/work/sources/webhosting/gij-sync-scripts 并包含这些修改后的文件(如我的 Windows 7 资源管理器中所示(使用 TortoiseGit):

enter image description here

最佳答案

正在运行 git status将为您提供有关整个存储库中文件的信息,而不仅仅是您当前所在的路径。路径将始终相对于您的当前目录显示,因此如果您不在根目录中 repo ,你最终会得到一个数字 f ../

例如从存储库根目录检查状态:

$ git status 
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: bar/knardel.c
# modified: baz/README.txt
# modified: foo/breslow.xml
#

但检查子目录中的状态 bar/会给你:

$ cd bar
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: knardel.c
# modified: ../baz/README.txt
# modified: ../foo/breslow.xml
#

如果您只想查看当前子目录及其子目录的状态,您可以将当前目录 ( . ) 指定为 <pathspec> :

$ git status .
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: knardel.c
#

关于git - 文件被列为前缀为 ../in git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18056633/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com