Search code examples
gitgit-submodulesgitignoresubdirectorygit-subtree

Completely independent Git project within another project using only gitignore


Is it possible to work with two independent git projects, one within another in the directory tree and separate them using only gitignore (without submodules or subtrees)?

Here is the folder structure:

repo_a     <-- repository A folder
   /.git
   /folder_1
   /folder_2
   /repo_b    <-- repository B folder (to be ignored by repository A)
       /.git
       /folder_3
       /folder_4

Solution

  • This is possible. Configure the repo_a to ignore the repo_b by adding :

    repo_b/
    

    in the .gitignore

    This will ingore the directory, meaning if you clone the repo_a it will not have an (empty) repo_b directory.