gpt4 book ai didi

git 看不到文件...如何理解哪里出了问题?

转载 作者:太空狗 更新时间:2023-10-29 13:24:29 24 4
gpt4 key购买 nike

问题 1。我试图让 git 跟踪我的文件“altro.src”但没有成功。该文件被 git 完全忽略,即使没有在 .gitignore 中列出,它也不会用 --ignored 显示,即使我尝试 git-add 它,也不会被考虑。

我是 git 的新手(第三次提交......我已经卡住了)但是我有一些长期使用 hg 的经验。

下面是一些命令来显示问题:

$ ls -al altro.src
-rw-r--r-- 1 myuser staff 560 28 Mar 09:02 altro.src

$ git status .
On branch master
Your branch is up-to-date with 'origin/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)

typechange: moebius.html

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

$ cat .gitignore
*~
.DS_Store

/index.html
/index.en.html
/moebius.html
/moebius.en.html
/altro.html
/altro.en.html
$ git status . --ignored
On branch master
Your branch is up-to-date with 'origin/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)

typechange: moebius.html

Ignored files:
(use "git add -f <file>..." to include in what will be committed)

.DS_Store
.gitignore~
altro.en.html
altro.html
altro.src~
base.src~
build_site.py~
index.en.html
index.html
moebius.en.html
moebius.src~

no changes added to commit (use "git add" and/or "git commit -a")
$ git add altro.src
$ git status .
On branch master
Your branch is up-to-date with 'origin/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)

typechange: moebius.html

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

问题 2。我不明白文件 moebius.html 上的“typechange”是什么意思以及如何删除该消息(moebius.html 在我的 .gitignore 中,我希望它被忽略)。

最佳答案

我怀疑这只是 altro.src 自您之前 checkin 后未更改。如果您尝试暂存未更改的文件,Git 不会警告您,但它不会将其添加到暂存区(索引),因此它不会显示在 git status 中。换句话说,如果你要求 Git 添加已经存在的东西,它就没有工作要做。

您可以通过运行 git diff altro.src(可能不会显示任何更改)和 git log altro.src(查看您的哪些提交之前添加了它)来检查这一点).

typechange 注释告诉您文件类型已更改(例如,从常规文件更改为文件链接)。

关于git 看不到文件...如何理解哪里出了问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22735437/

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