简体   繁体   中英

Can i auto pull code to a new repo from multiple repos in git?

I need to club multiple git repos to one single repo, in an attempt to club the scattered code.

At this step I am not re factoring any code just clubbing all related projects from 4 different repos(say repoA, repoB, repoC and repoD) to one single repo(say repoFinal).

However my concern is that, new commits and pushes will be made to repoA, repoB, repoC and repoD almost everyday.How do I keep up with the changes in all four repo and update that in my repoFinal on daily basis?

Is there any way I can automate this? or do I need to keep a track of it manually?

I did read about web hooks, however I am not sure

1) if it will work if I have 4 repos to be updated in one repo?

2) structure of repoFinal will be different than all other four repos eg:

repoA --> ProjectA

repoB --> ProjectB

repoC --> ProjectC, ProjectG

repoD -->ProjectD, ProjectE and ProjectF

finalRepo --> ProjectA, ProjectB,ProjectG, ProjectD, ProjectE (I do not want ProjectC and ProjectF in my new repo)

Any suggestions or insight will be helpful.

Create a FinalRepo and add the other repos using git submodules. Each time you want to synchronize you just go in to each submodule and do a git pull and then commit the FinalRepo at the root.

Have a look at https://git-scm.com/book/en/v2/Git-Tools-Submodules

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