Adrian
Adrian

Reputation: 3052

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

Upvotes: 1

Views: 176

Answers (3)

hannu40k
hannu40k

Reputation: 552

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.

Upvotes: 1

Md. Mahabubur Rahman
Md. Mahabubur Rahman

Reputation: 820

Try wp-content/cache/* or wp-content/cache/ in your .gitignore file

Upvotes: 1

WayneNani
WayneNani

Reputation: 183

I think the syntax is just

wp-content/cache/

in your .gitignore file.

Upvotes: 3

Related Questions