添加后 git 仍未跟踪

发布于 2024-09-13 14:28:02 字数 410 浏览 19 评论 0原文

每次我执行 git status 时,这个文件夹都会显示为未跟踪。

$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       src/error/
nothing added to commit but untracked files present (use "git add" to track)

即使在执行 git add . 、 git commit -a 后, src/error 处的文件夹仍然显示为未跟踪。每当只有此文件夹不断出现问题时,就会提交其他未暂存的文件。 git 也不会报告任何错误。这里可能有什么问题?

Everytime I do git status there is this folder that appears as untracked.

$ git status
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       src/error/
nothing added to commit but untracked files present (use "git add" to track)

Even after doing git add ., git commit -a the folder at src/error keeps showing up as untracked. Other unstaged files get commited everytime only this folder keeps giving problems. Also git doesnt report any errors. What could be the problem here ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

多孤肩上扛 2024-09-20 14:28:02

我发现了问题和解决方案,这就是发生的情况:

当我在本地更改大小写时,第一个 src/error 被称为 src/Error ,文件夹名称已更改,但在 git 中它仍然被提交为 src/Error 。 Windows 不区分大小写,因此我所做的是删除文件夹提交并使用正确的大小写再次添加它。

I found the problem and the solution this is what happened:

First src/error was called src/Error when i changed the case locally the foldername was changed but in git it was still commited as src/Error. Windows is case-insensitive so what i did was remove the folder commit and add it again with the right casing.

且行且努力 2024-09-20 14:28:02

文件夹是否为空,如果是正常情况,请参阅此处

Is that the folder empty if so it is normal, see here

硪扪都還晓 2024-09-20 14:28:02

我已经在 Windows 7 控制台中尝试了以下操作,它有效,即它没有将 \src\error\ 显示为未跟踪。

C:\t>dir
 Volume in drive C is BLAH
 Volume Serial Number is 2ECA-CB88

 Directory of C:\t

10.08.2010  17:56    <DIR>          .
10.08.2010  17:56    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  59'844'902'912 bytes free

C:\t>mkdir .\src\error

C:\t>copy con: .\src\error\text.txt
blah^Z
        1 file(s) copied.

C:\t>git init
Initialized empty Git repository in C:/t/.git/

C:\t>git add .\src\error\*

C:\t>git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   src/error/text.txt
#

这并不能回答您的问题,但我认为查看完整的分步示例可能会有所帮助。

I've tried the following in a Windows 7 console and it worked, i.e. it did not show \src\error\ as untracked.

C:\t>dir
 Volume in drive C is BLAH
 Volume Serial Number is 2ECA-CB88

 Directory of C:\t

10.08.2010  17:56    <DIR>          .
10.08.2010  17:56    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  59'844'902'912 bytes free

C:\t>mkdir .\src\error

C:\t>copy con: .\src\error\text.txt
blah^Z
        1 file(s) copied.

C:\t>git init
Initialized empty Git repository in C:/t/.git/

C:\t>git add .\src\error\*

C:\t>git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#       new file:   src/error/text.txt
#

This doesn't answer your question, but I thought it might help to see a full step-by-step example.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文