Ignoring Files and Folders in Git

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 subdirecties 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

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Web page addresses and e-mail addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <drupal5>, <drupal6>, <javascript>, <php>, <sql>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options