Reputation: 1673
I have a c:\git folder where I store all my code. In this folder is a folder for each application/solution. Each application/solution can have many projects.
Example folder structure:
c:\git\abc\abc-da\
c:\git\abc\abc-WebUI\
c:\git\abc\abc-WinService\
c:\git\abc\abc-Tester\
c:\git\abc\abc-UnitTest\
My question is this:
If I put my VisualStudio.gitIgnore file in the c:\git\abc\ folder (named .gitignore obviously) then would it apply to all subfolders? or do I have to copy the .gitignore to each project folder?
Upvotes: 0
Views: 2564
Reputation: 2866
.gitignore
applies to a project from the root, and matches children via the glob search. Additionally, any .gitignore
files in children directories from the root of a project, will apply the same. This stops once you hit a .git
directory (the indicator for the start of a repo).
Separately from that, you can set a global .gitignore
file that Git will apply to all projects under a particular git installation (or, installations referencing that file).
git config --global core.excludesfile ~/.gitignore
Usually this goes in your home folder as ~/.gitignore
or ~/.gitignore_global
and is used to ignore files related to your personal setup (ie, you use IntelliJ? Ignore .idea
, don't ignore it on every project).
Beyond that, I do not believe Git has additional builtin functionality for .gitignore
.
Fantastic references:
Upvotes: 2