1

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 ?

3
  • 1
    Make them subprojects. Commented Mar 17, 2019 at 17:35
  • 1
    One by one, there is no automatic way. Commented Mar 17, 2019 at 18:20
  • You probably want subtrees atlassian.com/blog/git/… Commented Mar 18, 2019 at 2:26

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.