I've found this official .gitignore file for Visual Studio: https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
I have a question to ask, for parts like this:
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
Yeah, I get it, they're meant to exclude every build output folder, and implicitly their content, but will this exclude them if they're not directly at the root of the repo?
To put that in context: I'm creating a repo in the parent folder of all solutions. I'm not talking about a solution which contains many projects, because if that were the case, VS would solve the problem for me.
I'm creating the repo in a folder containing solutions, which, could be single-project (in which case I'd mark the option to use same folder for solution and project on project create) or multi-project.
So, if I use that .gitignore in the root of the repo, would that exclude every "ignorable" file/folder in every project? Or would the .gitignore file need some changes for that?
CodePudding user response:
will this exclude them if they're not directly at the root of the repo?
Yes: the gitignore
man page does mention:
The pattern
foo/
will match a directoryfoo
and paths underneath it, but will not match a regular file or a symbolic linkfoo
.
a /foo/
would limit that to the current .gitignore
folder.