search

Home  >  Q&A  >  body text

版本控制 - git .gitignore 这样写却无法忽略目录,怎么都无法忽略目录

版本控制用的是git,部分文件位置

/.git -- git文件夹
/.gitignore
/.htaccess -- 重写文件
/index.php -- 网站入口文件

.gitignore 内容

*.zip
*.rar
*.bak
*.log
sessions
deleted
000
tplcache
uploads/userup
uploads/litimg
cache*.php

结果

1.有的文件是忽略了比如根目录下的 /backup.zip
2.但是很多还是没有忽略,

比如 /data/0000-deleted---backup 
比如 /data/tplcache
比如 /data/cache 
比如 /data/sessions
比如 /fs.zbphp.com/000-deleted

这些文件夹还是没有忽略掉,他们文件夹图标上还有有一个勾。

3.有一些居然被忽略了,比如 /special 文件夹(空文件夹),他们文件夹图标上没有勾
为情所困为情所困2777 days ago722

reply all(2)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-04-25 09:06:25

    1. This file was added later.
    2. These added files will not be automatically removed from git, you need to do it manually. If you add the .gitignore file before using git to track these files for the first time, git will not add these files. See your description , it should be the .gitignore file that you added after you managed all the files with git first. But the folders above you have already been added by git.
    3. Git will not track empty folders. If you need to keep an empty folder, you can add a blank file in the folder. Similar to .gitkeep

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-04-25 09:06:25

    Based on your .gitignore内容来看?那些没被忽略的文件夹不是很正常么?你要忽略的话怎么着也得写个data吧?另外,需要提醒的是.gitignoreIt seems that you can't ignore the pushed folders. As for how to ignore the pushed files, SF has related answers before. You can find out by searching.

    reply
    0
  • Cancelreply