问题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中,我希望它被忽略)。
答案 0 :(得分:3)
我怀疑这是因为你之前检查过altro.src
没有改变。如果您尝试暂存未更改的文件,Git不会警告您,但它不会将其添加到暂存区域(索引),因此它不会显示在git status
中。换句话说,如果你要求Git添加已经存在的东西,那就没有工作要做了。
您可以通过运行git diff altro.src
(可能不显示更改)和git log altro.src
(以查看之前添加的提交内容)来检查此内容。
typechange 注意告诉您文件类型已更改(例如从常规文件更改为文件链接)。