Ignoring Files and Folders in Git

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

Just a hint, it’s a lot easier than Subversion. My love for Subversion grows colder each day.

In your repository root directory you’ll want to create a file called .gitignore. In that file you’ll want to specify files and folders to ignore. For example.

Ignore the entire Magento /media folder. media/**/*

The root repository .gitignore file will act as a global but can be overridden in subdirectories by creating a .gitignorein those directories.

A Gotcha! 

Empty directories do not get tracked by Git. If you want them to be tracked, they need to have something in them. Usually doing a touch .gitignore is enough to keep the folder tracked.

This one stumped me for a little bit, anyway, it pays to read.

Credit: http://www.gitready.com/beginner/2009/01/19/ignoring-files.html http://github.com/guides/ignore-for-git

Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. [email protected]