Mario's Blog

The journal of a software developer who has a fondness of cheese

Some Fun With Git

Found a neat trick today while trying to figure out something in git:

I had a folder in my project which i wanted to be ignored and not tracked by git, the folder was called site, so my gitignore file had the following line:


Although today i realised there was a subfolder called javascripts which i wanted to track, but still ignore the rest of site. Instead of manually setting ignore for each of the folders and files within site i googled around a bit and came up with this:


This ignores all of the files and subfolders in site except for javascripts.

I love git :) Also I wasn’t sure if the author of this post was kidding, or serious ?