gpt4 book ai didi

git文件一次又一次地被删除

转载 作者:行者123 更新时间:2023-12-04 14:38:52 25 4
gpt4 key购买 nike

我克隆了一个项目,使用 Web UI 可以看到有 3 个文件。

克隆后,我注意到我只有 2 个文件。我检查了分支,我在 master 上,我应该有 3 个文件。

这是 git status 的输出:

On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

deleted: con.js

no changes added to commit (use "git add" and/or "git commit -a")

但我没有删除任何文件!

git ls-files --deleted : con.js

好吧,奇怪的错误,然后我尝试恢复在克隆时奇怪地被删除的文件,所以我输入 git checkout con.js

在我输入 git checkout con.js 后,完整的文件会打印在终端中。我怀疑它会立即再次被删除。如果我然后输入 git ls-files --deletedcon.js 它仍然存在并且没有恢复!

我可能做错了什么?

最佳答案

Do not use the following reserved names for the name of a file:

CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8,COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Alsoavoid these names followed immediately by an extension; for example,NUL.txt is not recommended.

https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file

Git 预计在 Windows 上存在许多文件问题,例如 aux.js、con.cpp 等。最好的办法是在存储库中重命名此文件。

关于git文件一次又一次地被删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58432728/

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