Project with multiple git repos

Answered

Hi, my project consists of multiple repos. Each repo has a branch `master`. SOME repos also have a branch `develop`.

1) Is there any way to specify that I have these 2 "default" configurations, so all diffing/rebasing would be done against those?

2) When I update the project while working on feature branches, I run a script that does rebase on origin/master or origin/develop, depending on a repo. Note the "origin/" part. I don't want to rebase on local `master` or `develop` because in order to update it I'd need to check it out, update, then check out my feature branch, and finally rebase. I only want to switch to `develop` if I want to (e.g. my work on feature branch is done), not in order to rebase my feature branch, otherwise I don't care what's in the local `develop` branch, I always want to rebase on origin/develop (or origin/master, depending on repo).

So, basically, I want to have 2 modes of updating the project: a "normal" one, where each repo on a branch xxx is rebased to origin/xxx (I guess that's what the current "Update project" does in rebase mode), and "origin" when a branch xxx is rebased to origin/master or origin/develop, depending on a repo.

Can CLion help me with anything of this or I'm stuck with my shell scripts?

5 comments
Comment actions Permalink

Hello Maxim Yanchenko

In branches popup you can find section "Common Remote branches" and you can use  "Pull with rebase" for origin/master

0
Comment actions Permalink

Ruslan Kuleshov I guess I need to do it for each repo manually, selecting origin/master or origin/develop based on the repo? I have 20+ repos, it's not feasible :)

0
Comment actions Permalink

Ruslan Kuleshov, could you please elaborate? I don't see how a SINGLE repo popup helps me to update ALL repos at once. Am I missing something?

0
Comment actions Permalink

Currently, there is a concept of Common branches. If a branch exists in ALL repositories in the project, then it is possible to run a command against this branch in all repositories at once. To do this one needs to call the action from the Common branches section in the branches popup.

You mention that the master branch exists in all repositories, so you should be able to rebase all on top of origin/master by calling e.g. Pull with Rebase action on it using the Common Remote Branches section.

Ensure the Execute branch operations on all roots option in Settings | Version Control | Git is enabled to see the section.

Unfortunately, if the configuration of your repos differ (some have master, others develop), IDE can not handle all of them at once.

0
Comment actions Permalink

Understood, thanks. Yes, I want to specify explicitly which directories should look at origin/master and which at origin/develop.

Created a feature request https://youtrack.jetbrains.com/issue/CPP-27309.

Please feel free to ask any questions if anything is unclear about the workflow.

0

Please sign in to leave a comment.