Git wants to ignore a folder but not a file. The setting rules are invalid. What's going on?
天蓬老师
天蓬老师 2017-05-02 09:40:59
0
4
608

If you want to ignore all file tracking in the upload folder, but not ignore index.html, single rule

Set as follows in the .gitignore file

uploads/*

uploads/!index.html

But it doesn’t work, index.html is also ignored and not tracked. Is there something wrong with this syntax?

Git version 2.6.3

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(4)
Ty80
upload
!upload/index.html
伊谢尔伦

Create a new .gitignore under the upload folder with the following content:

*
!.gitignore
!index.html
漂亮男人

Floor 2 is correct, if you don’t want to upload文件夹下新增.gitignore, you can put your code

uploads/*

uploads/!index.html

Swap the positions, because your rule is

Filterupload文件夹下的所有文件, 然后你再不让其忽滤index.html, all files have been filtered, of course index.html no longer exists

某草草

My personal test was to write it like thisuploads/* uploads/!index.htmlIt didn’t work. Later I researched it and found that it can be written like this. See my blog post http://blog.csdn.net/CalShell...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template