github - Git 无法忽略目录,怎么都无法忽略目录
某草草
某草草 2017-04-26 09:01:42
0
5
632

使用的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忽略目录。

某草草
某草草

reply all(5)
迷茫

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'
小葫芦

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.

小葫芦

The first correct answer, git rm --cache

仅有的幸福

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
PHPzhong

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?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!