eugene
eugene

Reputation: 41665

ignore directory which has .git subdirectory?

I'd like to ignore directories if it has it's own .git directory.

project-root
  - sub-project1 (with `.git`)
  - sub-project2 (with `.git`)
  - other files

How can I tell(.gitignore) to ignore all the directories with its own .git such as sub-project1/2 ?

Upvotes: 1

Views: 60

Answers (1)

VonC
VonC

Reputation: 1324278

You would need a script which would:

  • find an .git subfolder
  • take their parent folder (dirname)
  • add it to .gitignore (if not already present)
  • remove it from the index (in case it would already recorded by the parent repo as a gitlink entry)

Upvotes: 1

Related Questions