search

Home  >  Q&A  >  body text

github - Git 无法忽略目录,怎么都无法忽略目录

使用的ThinkPHP,git目录在D:/website/example.com/.git/
要忽略的目录 D:/website/example.com/www/Application/Runtime的这个Runtime目录






我所执行的操作:

1.在目录D:/website/example.com/www/application/Runtime 
右键点击删除并且添加到忽略列表

2.截图中的那些默认的选择,然后在D:/website/example.com/.gitignore 
文件里面有了自动生成的一段内容 */www/application/Runtime*

3.但是再去看 Runtime的图标,却是一个红色的圆叹号。并没有变成忽略的

4.而且git给出的忽略选项中“删除并且添加到忽略列表”,
为什么一定要删除,我只是想让他被忽略而已。

现在的问题是怎么都无法让git忽略目录。

某草草某草草2776 days ago657

reply all(5)I'll reply

  • 迷茫

    迷茫2017-04-26 09:03:42

    If you are willing to use the command line and want git to ignore a tracked directory (and never care about it again):

    $ git rm -r --cached dir
    $ echo dir/ >> .gitignore
    $ git add .gitignore
    $ git commit -am 'ignore dir forever'
    

    reply
    0
  • 高洛峰

    高洛峰2017-04-26 09:03:42

    This deletion is not what you want, it just deletes the tracking record from the Git database. If you don’t do this, it will still come back during the next synchronization because the history record still exists. This is why you can never block it. . I have never used this operation of Gui. I am not sure if the corresponding command is git rm. If so, don’t worry about the file being lost. If you are worried, do a manual backup first and then you will know after a try.

    reply
    0
  • 高洛峰

    高洛峰2017-04-26 09:03:42

    The first correct answer, git rm --cache

    reply
    0
  • 仅有的幸福

    仅有的幸福2017-04-26 09:03:42

    Create a new .gitignore file in the root directory command line
    For example: To ignore the cache folder
    Then write /cache

    in the .gitignore file

    reply
    0
  • PHPz

    PHPz2017-04-26 09:03:42

    Ask, has the problem about git ignoring the specified directory you raised on segmentfault.com last time been resolved? Can you tell me how to solve it?

    reply
    0
  • Cancelreply