Git未跟踪的文件列表是错误的 [英] Git untracked files list is wrong

查看:229
本文介绍了Git未跟踪的文件列表是错误的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知何故,git明白了我有一个未跟踪的文件(一个目录已经在我的存储库中存放了一段时间,大约17个月)。无论如何,我似乎无法说服git这不是一个没有跟踪的文件。此外,我无法重新添加有问题的文件。任何想法如何解决这个问题?



例子:

 ➜ git status 
#在分支主机上
#未记录文件:
#(使用git add< file> ...来包含在提交的内容中)

#rosetta_tests / profile / tests / docking /
没有添加提交,但未跟踪文件存在(使用git add跟踪)

我尝试添加目录并重新检查状态。

 ➜ git add rosetta_tests / profile / tests / docking / 
➜git status
#在分支大师
#未追踪文件:
#(使用git add< file> ... 包含在将要提交的内容中)

#rosetta_tests / profile / tests / docking /
没有添加提交但未跟踪文件存在(使用git add跟踪)

只要(从我的源代码树的根目录)

 ➜git add。 
¶git status
#在分支主机上
#未记录文件:
#(使用git add< file> ...来包含将要提交的内容)

#rosetta_tests / profile / tests / docking /
没有添加提交,但未跟踪的文件存在(使用git add来跟踪)

这是怎么回事?我该如何说服git修复它自己?

编辑

详细信息:

- 文件不在.gitignore中



- 文件夹中有三个跟踪文件有问题,所以它不是空的



- 经过更多挖掘,似乎可能会因更改跟踪文件夹的情况而出现类似情况。不幸的是,这并非如此(双关!)。



- 停靠目录的内容:

 ➜ls -lA rosetta_tests / profile / tests / docking /。 
total 16
-rw-r - r-- 1 tim工作人员2209 Jul 17 10:47 command
-rw-r - r-- 1 tim工作人员260 Jul 17 10: 47 flags
drwxr-xr-x 3 tim staff 102 Jul 17 10:47 input


解决方案

git add。命令中引用当前目录。因此,运行 git add。会添加当前目录及其子目录中的所有文件。在运行 git add 之前,你应该确保你的目录是正确的。



git添加-A 就是你想要的。它会添加所有内容。


Somehow, git got it in its head that I have an untracked file (A directory that has been in my repository for quite some time, ~17 months). At any rate, I can't seem to convince git that this is not an untracked file. Furthermore, I can't re-add the file(s) in question. Any idea how I can fix this?

Example:

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

I try to add the directory and re-check the status.

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

Just to be sure (from the root of my source tree)

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

What is going on here? How can I convince git to fix itself?

EDIT

A few more details:

-The files are not in the .gitignore

-There are three tracked files in the folder in question, so it's not empty

-After even more digging, it seems something like this could arise from changing the case of a tracked folder. This, unfortunately, is not the case (pun!). The folder name has never changed case.

-Contents of the docking directory:

➜ ls -lA rosetta_tests/profile/tests/docking/.
total 16
-rw-r--r--  1 tim  staff  2209 Jul 17 10:47 command
-rw-r--r--  1 tim  staff   260 Jul 17 10:47 flags
drwxr-xr-x  3 tim  staff   102 Jul 17 10:47 input

解决方案

The . in the git add . command refers to the "current directory". So, running git add . will add all the files in the current directory and its subdirectories. You should ensure that you are in the correct directory before running git add.

git add -A is what you want. It will add everything.

这篇关于Git未跟踪的文件列表是错误的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆