基本上,我有以下文件夹结构:的.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