基本上,我有以下文件夾結構:的.gitignore不能忽略的所有文件夾除外
repo
README.md
testing_folder
readingme.md
resources_folder
我
.gitignore file
而且,我想忽略除當前目錄下的文件夾的所有文件,這是什麼我有:
*
!.gitignore
!*/
當我做git status
,這就是我得到:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: .gitignore
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)
modified: .gitignore
modified: README.md
問題是:它沒有顯示testing_folder
和resources_folder
是untracked
。當我嘗試做git add testing/readingme.md
,我得到了以下錯誤消息:
The following paths are ignored by one of your .gitignore files:
testing/readingme.md
Use -f if you really want to add them.
fatal: no files added
我開始變得很困惑,因爲我已經看了這麼多其他相關的職位。他們似乎工作,但我的工作不起作用。
我試圖在.gitignore文件中包括和排除!*/
語句,但仍然不顯示文件夾爲untracked
。
兒童目錄中的文件呢?你是否希望它們被忽略,或只有頂級目錄中的文件? – 2014-12-03 20:11:53
涵蓋兩種情況的答案都很好。 – mynameisJEFF 2014-12-03 20:15:19