Ignore Symfony2 PHPStorm files like a pro with global ignoring

Often I see in some projects people keep adding their environment specific ignore files into .gitignore or .git/info/exclude over and over. This is a waste of time and does reveal we don’t know git as we ought to. A good example is for those people using netbeans which I do not recommend, or using PHPStorm and are adding ignoring for files under .idea folder or other netbeans folder. Today I got sick of this and I knew there was a way to ignore globally but did not know how to make it very easily. Found it here https://help.github.com/articles/ignoring-files#global-gitignore. Basically:

git config --global core.excludesfile ~/.gitignore_global

This will basically build under your [core] key under ~/.gitconfig the following entry:

[core]
        excludesfile = /Users/cordoval/.gitignore_global

Now you can go into .gitignore_global and add the annoying .idea and netbeans folders if you want.

I have added these:

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
 
.idea

Symfony2 has some specific entries provided here https://github.com/github/gitignore, however because I do often develop libraries or that is what i want at least, I prefer to keep it short. The ignores at the symfony2 level should be better handled via de local repository’s .gitignore in this case.

Hope that helps and saves you tons of time.

Encouragements in all good!

2 thoughts on “Ignore Symfony2 PHPStorm files like a pro with global ignoring

  1. You can also add this in your global exclude (above your OS generated files) :

    # Compiled source #
    ###################
    *.com
    *.class
    *.dll
    *.exe
    *.o
    *.so

    # Packages #
    ############
    # it’s better to unpack these files and commit the raw source
    # git has its own built in compression methods
    *.7z
    *.dmg
    *.gz
    *.iso
    *.jar
    *.rar
    *.tar
    *.zip

    # Logs and databases #
    ######################
    *.log
    *.sql
    *.sqlite

Leave a Reply to Jean-Louis Cancel reply

Your email address will not be published. Required fields are marked *