git忽略了不在.gitignore中的文件?

时间:2010-11-09 01:22:03

标签: linux git gitignore

解决:决定删除.git目录并重试,因为无论如何都没有。 rm -rf .git ,然后是 git init ,然后是 git add。。现在它正在工作,一切都正确添加,应该忽略的事情是。想想我错误克隆了960gs或html5boilerplate到项目目录而不是子目录。非常感谢大家的回复。


关于git无法忽略.gitignore中指定的文件,有很多问题。我的问题恰恰相反 - git忽略了.gitignore中列出的文件。

例如,我刚刚使用HTML5Boilerplate960 Grid System启动了一个Web项目,并尝试进行初始提交。但是,当我运行'git add *'时,我只需要暂存一些我需要的文件和目录。

项目目录中的

.gitignore指定要忽略的项目,vcs和其他文件的列表,但不包括* .html,*。xml,*。conf,.htaccess,* .ico,* .png文件,其中没有上演指数。奇怪的是,正在添加一个html文件,demo.html,而index.html不是。

任何人都知道什么是错的以及如何解决它?

为清晰起见,这是操作的记录:

%> ls -al
total 136
drwxr-xr-x 13 me me  4096 2010-11-08 14:04 .
drwxr-xr-x  6 me me  4096 2010-11-08 13:23 ..
-rw-r--r--  1 me me   720 2010-11-08 13:21 404.html
-rw-r--r--  1 me me  1893 2010-11-08 13:21 apple-touch-icon.png
drwxr-xr-x  3 me me  4096 2010-11-08 13:21 build
-rw-r--r--  1 me me   802 2010-11-08 13:21 crossdomain.xml
drwxr-xr-x  3 me me  4096 2010-11-08 13:24 css
drwxr-xr-x  2 me me  4096 2010-11-08 13:21 demo
-rwxr-xr-x  1 me me  8920 2010-11-08 13:15 demo.html
-rw-r--r--  1 me me  1150 2010-11-08 13:21 favicon.ico
drwxr-xr-x  8 me me  4096 2010-11-08 14:04 .git
-rw-r--r--  1 me me   266 2010-11-08 13:44 .gitignore
-rw-r--r--  1 me me  8011 2010-11-08 13:21 .htaccess
drwxr-xr-x  2 me me  4096 2010-11-08 13:21 images
drwxr-xr-x  2 me me  4096 2010-11-08 13:15 img
-rw-r--r--  1 me me  3115 2010-11-08 13:21 index.html
drwxr-xr-x  5 me me  4096 2010-11-08 13:21 js
-rw-r--r--  1 me me  5166 2010-11-08 13:21 lighttpd.conf
-rw-r--r--  1 me me  3484 2010-11-08 13:21 mime.types
-rw-r--r--  1 me me  3413 2010-11-08 13:21 nginx.conf
-rw-r--r--  1 me me     0 2010-11-08 14:04 output.txt
-rw-r--r--  1 me me  6277 2010-11-08 13:21 README.markdown
-rw-r--r--  1 me me   107 2010-11-08 13:21 robots.txt
drwxr-xr-x  4 me me  4096 2010-11-08 13:17 templates
drwxr-xr-x  3 me me  4096 2010-11-08 13:21 test
drwxr-xr-x  2 me me  4096 2010-11-08 13:45 vim~
-rw-r--r--  1 me me 12274 2010-11-08 13:21 web.config
drwxr-xr-x  2 me me  4096 2010-11-08 12:09 wireframes

%> less .gitignore
# Numerous always-ignore extensions
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~

# OS or Editor folders
.DS_Store
.cache
.project
.settings
nbproject
thumb.db

# Folders to ignore
.hg
.svn
publish
.idea
templates
template

# files
build/buildinfo.properties

%> git add *
# Not currently on any branch.
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#   new file:   css/960.css
#   new file:   css/960_24_col.css
#   new file:   css/reset.css
#   new file:   css/rtl_960.css
#   new file:   css/rtl_960_24_col.css
#   new file:   css/rtl_text.css
#   new file:   css/text.css
#   new file:   css/uncompressed/960.css
#   new file:   css/uncompressed/960_24_col.css
#   new file:   css/uncompressed/demo.css
#   new file:   css/uncompressed/reset.css
#   new file:   css/uncompressed/rtl_960.css
#   new file:   css/uncompressed/rtl_960_24_col.css
#   new file:   css/uncompressed/rtl_text.css
#   new file:   css/uncompressed/text.css
#   new file:   demo.html
#   new file:   img/12_col.gif
#   new file:   img/16_col.gif
#   new file:   img/24_col.gif
#   new file:   wireframes/basalmiq01.pdf
#   new file:   wireframes/basalmiq01.png
#   new file:   wireframes/basalmiq01.xml
#   new file:   wireframes/fcf_mockingbird.zip
#   new file:   wireframes/fcf_mockingbird_.zip
#
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   .gitignore
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   output.txt

1 个答案:

答案 0 :(得分:1)

也许这些文件已经由git控制。