I am aware of using .gitignore file to exclude some files being added, but i have several "config.php" files in source tree and I need to exclude only one, located in the root while other keep under revision control. What I should write into .gitignore to make this happen?
+1 for conciseness.
Rob Wilkerson
2010-09-03 19:14:51
+7
A:
From the documentation:
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 .gitignore file (relative to the toplevel of the work tree if not from a .gitignore file).
A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
So you should add the following line to your root .gitignore
:
/config.php
Manoj Govindan
2010-09-03 16:26:26
Thank you! I tried it this way, but for some reason it didn't worked. Probably mistyped somewhere something =)
Pavel Karoukin
2010-09-03 18:03:58