+6

Multi-repository Support: Commit

Dexx 8 years ago updated by Marc Strapetz 4 years ago 7

When you have a project with many modules (10+) in separate repositories (modularity at all costs), it's hard to manage them together. There's already a topic about multi push / sync (https://smartgit.userecho.com/topics/219-multiple-push-sync/), what I'm missing beyond those, is committing together.


Let's say you're working on a bigger feature that affects 50% of your repos. Staging the changes individually in each repo is unavoidable I think, but when you're finished with it, you need to commit them one-by-one. Even though your commit message will be the same for all (usually).


Here, an enhanced commit window (where all staged changes for the selected repos could be listed, groupped by the repos) would be very useful, and you would need do only a single commit, with the same commit message for all, in one step. Any chance for such feature?

Do you mean independent repositories or submodule repositories inside one outer repository?

Yes, independent repositories.

Wow, And hear I thought Grouping Commit+Submodule/Commit was going to be hard.. Completely separate repos sounds very challenging.

-1

Sorry for smart-ass reply but best solution is to merge your repos in my opinion. Only legit reason I can think of is permissions (e.g. cooperating with external teams). Otherwise I'd say KISS.

It's not caused by any permission consideration. The reason we have separate repos is the fact we try to develop our modules to be reusable (therefore to keep them as independent from each other as much it's possible), so merging them into a single repo is not an option. Actually there's a tool which tries to provide this kind of developing: (JetBrain) PhpStrom's integrated Git client. Their tool can pull, push and commit all the repositories inside the whole project together. And as all of our repos are there (actually it's a framework that consists of many individual repos), we can simply commit push and pull all repo alltogether. The reason we still would appreciate this functionality in SmartGit is because we like it's GUI much better (and PhpStorm currently doesn't support Git's index... so no individual lines/selections/hunks can be committed, only whole files).

We have a similar set of reusable modules and we are using a master repo which has all other repos as submodules (i.e a monorepo) to handle what you are describing.


Smart git is able to commit to multiple submodules (and the parent repo itself) at the same time, and we have used this feature when making sweeping changes to all our repos, like changing line endings or whitespace.


Having a monorepo also saves the developers having to clone each repo separately. Instead SmartGit will clone all submodules automatically.

Ahh, They put in the "Commit to Master/Container & Submodule at the same time" feature? That one totally passed me by. It was something I needed in the past, but have changed jobs and no longer needed.. If that feature is in, then I would recommend doing that.

Each "submodule" can be committed to separately (as you may be doing already". And since your "master/container" repo is not a "end product", you do not have to worry about versioning that much. It should be childs play to just have all your current repos 1 folder deeper (within a container folder/container repo).. In the smartgit interface, they would all still have the same abilities.. Just (again) 1 level deeper inside the container repo.