简体   繁体   中英

How to ignore a folder and its contents in git?

I have a folder in wordpress called wp-content and a subfolder called cache. The cache folder also has folders and files inside it.

The location of my .gitignore file is inside my root directory.

The current code that I use to ignore the wp-content/cache and the contents inside it is:

wp-content/cache/*

The line above does not work. Do you know the correct way? Thanks

I think the syntax is just

wp-content/cache/

in your .gitignore file.

Although the syntax you used should work, you can try:

/wp-content/cache/*

In case the directory you are trying to ignore has already been committed previously, be sure to remove it first, and then see if your .gitignore entry has any effect for new changes.

.gitignore文件中尝试wp-content/cache/*wp-content/cache/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM