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'保存你的工作副本),然後提交修改。 –