DONGMO BERNARD GERAUD
DONGMO BERNARD GERAUD

Reputation: 237

Problem with .idea folder and .gitignore file

The .git and .idea folders are at the root of the project folder. But the .idea folder contains a .gitignore file, I don't know if I should create another at the root of the project, or I should use the one that already exists.

Upvotes: 0

Views: 693

Answers (1)

Mohit Ajwani
Mohit Ajwani

Reputation: 1338

The .gitignore is applicable only for the folder in which it resides. For a project-level gitignore you need to keep it at the project root folder.

Read more about gitignore here

https://git-scm.com/docs/gitignore

Each line in a gitignore file specifies a pattern. When deciding whether to ignore a path, Git normally checks gitignore patterns from multiple sources, with the following order of precedence, from highest to lowest (within one level of precedence, the last matching pattern decides the outcome):

Patterns read from a .gitignore file in the same directory as the path, or in any parent directory, with patterns in the higher level files (up to the toplevel of the work tree) being overridden by those in lower level files down to the directory containing the file. These patterns match relative to the location of the .gitignore file. A project normally includes such .gitignore files in its repository, containing patterns for files generated as part of the project build.

Upvotes: 1

Related Questions