简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM