Can I add assets directory to my .gitignore file

I’m not sure on the answer to this. Every now and then I see a load of assets files + folders being added to my git commit. Should I just gitignore the whole ‘assets’ folder?

I know you used to be able to delete all the assets in Yii 1 and it would just regenerate them.

1 Like

Yes - but only web/assets, not the one in your project root.

Ok, I don’t understand though why the root/assets folder just continually gets more and more sub folders added to it?? :unsure:

It shouldn’t. Can you show us what folders get created in there?


  • 2ca9fb63

  • 3f21efd7

  • 4db100cb

There’s about 30 folders all named with a hash.

You can safely add that directory to the .gitignore.

Before you do that, though, delete the directory (to wastebin) and check in git. You might need to commit the removal of the ‘assets’ directory.


Thanks, I assumed this was the case, but I wanted to double check :slight_smile: