A typical .gitignore
file in a "ruby on rails" context could look something like:
config/database.yml
db/*.sqlite3
log/*.log
log/*.pid
tmp/**/*"
But, as pointed out by the article "rorgitignore : .gitignore files specific for Ruby on Rails", you can also use .gitignore
to add empty directories.
Because git tracks contents, not files, it doesn't save any empty
directories, since there is no content to track.
This means that when you clone your project from a git
repository, it is
missing the log
, tmp
, lib
and other directories.
This small script fixes that, so git
adds even empty directories
for DIR in `find . -type d | sed -re 's/\.\///g' | grep -v '^\.git'`; do
[ `ls -a $DIR | wc -l` -le 2 ] && \
echo Creating and git-adding $DIR/.gitignore && \
touch $DIR/.gitignore && \
git add -f $DIR/.gitignore
done
this just outputs the commands to add an empty .gitignore
file to all empty directories in a git
project and git add -f
'em to the repo.
If you are still focused only on the main .gitignore file, here is a more complete one, from iCoreTech Research Labs
config/database.yml
*~
*.cache
*.log
*.pid
tmp/**/*
.DS\_Store
db/cstore/**
doc/api
doc/app
doc/plugins
coverage/*
db/*.sqlite3
*.tmproj
Capfile