If I put a pattern in a .gitignore file with a leading slash, does the slash refer to the directory in which the .gitignore file is located, or does it refer to the root of the whole repository?
(The man pages I have found have hidden this information carefully.)
This is the documentation text:
These are my guesses:
If you use an in-repository-
.gitignore, the directory in which the.gitignoreis located – it is not really useful to make it relative to the repository root.
A short experiment with same-named files in the repository root and a subdirectory (and a
.gitignorein this same directory) confirms this.If you use an
.git/info/excludeorcore.excludesfile, I suppose it is relativeto the repository root.
Also this is (for info/exclude) confirmed by the same test (both tests on 1.7.3.4).
Schnouki found the right part of the documentation about this (emphasis mine):
One could say that this fact could have been repeated again at the later part quoted above, for clarity.