Create top repo branch with specific subrepo branches

114 views Asked by At

Have a git infrastructure that consists of one top repo with several subrepos. Then we have a Jenkins infrastructure that takes a specific top-repo-branch to execute a pipeline on it.

Now I have committed and pushed code to a custom branch in one of the subrepos.

Naturally I'd like to test the jenkins pipeline with my custom code without merging into master or develop first.

Therefore how do I create a top-repo-branch that contains default branches in all repos (usually develop) except for that one repo I have worked on, where it should instead have my custom branch checked out?

1

There are 1 answers

1
LeGEC On BEST ANSWER

Unless I'm missing something, it's just a regular branch :

# starting from top repo :
git checkout -b newbranch

cd subrepo/
git fetch
git checkout <target branch> # or git merge, or edit files and commit+push,
                             # or anything ...

# go back to your top repo, and commit this new state :
git add subrepo
git commit