What is the proper syntax for the .gitignore file to ignore files in a directory?
Would it be
config/databases.yml
cache/*
log/*
data/sql/*
lib/filter/base/*
lib/form/base/*
lib/model/map/*
lib/model/om/*
or
/config/databases.yml
/cache/*
/log/*
/data/sql/*
/lib/filter/base/*
/lib/form/base/*
/lib/model/map/*
/lib/model/om/*
?
PATTERN FORMAT
A blank line matches no files, so it can serve as a separator for readability.
A line starting with
#serves as a comment.An optional prefix
!which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources.If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words,
foo/will match a directoryfooand paths underneath it, but will not match a regular file or a symbolic linkfoo(this is consistent with the way how pathspec works in general in git).If the pattern does not contain a slash
/, git treats it as a shell glob pattern and checks for a match against the pathname relative to the location of the.gitignorefile (relative to the toplevel of the work tree if not from a.gitignorefile).Otherwise, git treats the pattern as a shell glob suitable for consumption by
fnmatch(3)with theFNM_PATHNAMEflag: wildcards in the pattern will not match a/in the pathname. For example,Documentation/*.htmlmatchesDocumentation/git.htmlbut notDocumentation/ppc/ppc.htmlortools/perf/Documentation/perf.html.A leading slash matches the beginning of the pathname. For example,
/*.cmatchescat-file.cbut notmozilla-sha1/sha1.c.You can find more here
git help gitignoreor
man gitignore