newb7777
newb7777

Reputation: 563

Difference between .git/info/exclude and .gitignore

When I cloned a repo from GitLab to local, it along with source code it also pulled a file in the root folder caller .gitignore. There is also a folder called .git which contains a directory in info contains a file called exclude. Which one is the one that does the ignore (to me ignore and exclude mean the same)? Is it the ignore or exclude?

Upvotes: 18

Views: 4771

Answers (2)

newb7777
newb7777

Reputation: 563

Although the question is not about which is better ".gitignore" or "info/exclude", one thing to note is "gitignore" is instantaneous than exclude. It takes effect immediately during stating process versus "gitignore" takes effect in the beginning when you clone a repository.

Upvotes: -6

Mark Adelsberger
Mark Adelsberger

Reputation: 45659

They both contain "ignore rules" - filename patterns for which matching untracked files should be ignored.

The difference is that rules in .gitignore are shared through the repo, whreas rules in info/exclude are not. So if for some reason you need to locally ignore certain paths in a single clone, you would use info/exclude; but if a path should be ignored in all clones, you would use .gitignore

Upvotes: 32

Related Questions