Harish
Harish

Reputation: 425

git include nested sub-directory

parentfolder(git)
    |
    |---->project1(git)
    |
    |
    |
    |---->project2(git)
    |           |
    |           |---->code
    |
    |
    |
    |
    |---->project3(git)
                |
        code<---|
                |--->images

I am working on more than one projects and all my projects have different repo, i have read many articles about nested git.

But my question is that,there is any one command so that i can directly commit my parent folder and get all the changes of sub-folder(git) directly

Upvotes: 0

Views: 77

Answers (1)

Jeff Puckett
Jeff Puckett

Reputation: 41091

Assuming that all your nested repositories are git subtrees, then you can write a bash script that pulls new changes from each repository and adds the respective sub-directory to the parent staging area. Then you can use that script as a pre-commit hook for parent.

As an aside, I see all too often submodules and subtrees being used simply as dependencies. If you aren't actively developing in the submodules within the parent project and backporting commits, then you should instead consider using a dependency package manager such as composer or npm.

Upvotes: 1

Related Questions