[英]git doesn't see a file… how to understand what's wrong?
問題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
沒有改變。 如果您嘗試暫存未更改的文件,Git不會警告您,但它不會將其添加到暫存區域(索引),因此它不會顯示在git status
。 換句話說,如果你要求Git添加已經存在的東西,那就沒有工作要做了。
你可以通過運行git diff altro.src
(可能沒有顯示更改)和git log altro.src
來檢查這git log altro.src
(看看你之前添加了哪些提交)。
typechange注釋告訴您文件的類型已更改(例如,從常規文件到鏈接到文件)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.