5
问题1: 我试图让git跟踪我的文件“altro.src”但没有成功。该文件被git完全忽略,即使没有在.gitignore中列出,它也不会显示--ignign,即使我尝试添加它,它也不会被考虑。git没有看到文件...如何理解有什么不对?
我是一个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,我希望它被忽略)。
我觉得很愚蠢......是的,这是发生了什么事。 –
关于* typechange *问题:是的文件是一个符号链接,现在它是一个普通的文件。此外,该文件先前被跟踪,但现在我想让git忽略它(因为它是由源文件生成的)。我怎样才能摆脱这个信息? –
如果你不想再跟踪对'moebius.html'的修改,你可以使用'git rm --cached moebius.html'('--cached'保存你的工作副本),然后提交修改。 –