Since I'm a git newb, I had to recently set up git on my machine and try to figure out the best way to set up the ignore properties. Coming from an SVN background (and ClearCase, but I don't like to talk about that), I started to wonder what I needed to exclude from the commit in an ignore file. By doing searches in multiple areas, including the wonderful collections of
gitignores at github, I've come up with what I like to call "The Perfect .gitignore". This means I only have two .gitignore files. One in the root of my project, and the other in my home directory. That's right Git allows a global ignore file! If you know your envirnoment (i.e. - Eclipse in Windows), then you can make sure none of your projects will commit naughty environment code.
So here is my grails project .gitignore (just place this in project root):
And here is my Windows-Eclipse specific .gitignore_global (I put this in my home dir):
To use this global file, run something like:
git config --global core.excludesfile ~/.gitignore_global
where
~/.gitignore_global
should change to be wherever you want to host your config.
2 comments:
It is bad advice to ignore .project and .classpath - see here : http://stackoverflow.com/questions/10301845/synchronizing-eclipse-classpath-in-code-repository and here : http://wiki.eclipse.org/FAQ_How_do_I_set_up_a_Java_project_to_share_in_a_repository%3F
Udun, this is the first I've ever heard of including these... I remember "back in the old days" these two used to cause some issues, but judging from your links it looks like it's all better, so I will update the gist. Thank you for your imput!
Post a Comment