0

I have an application that has been split into multiple microservices

Despite being a small application where our single team manages all the microservices, all the microservices are held in their own repo instead of a monorepo

Ignoring whether this should have been a monorepo instead of multirepo, I want to learn how to manage multi repo

I use gitbash which I'm comfortable with (shows all code changes, let's me stash and manage commits etc)

But a single requirement could use multiple microservices (repos). GitBash will only show code changes for one branch for one repo so I have to keep navigating between paths to see the ode changes

Is there a way to use GitBash for multirepos? Or any better non-admin company safe alternatives?

E.g. -show ALL code changes -manage commits better (given ill have to make commits for each repo) -stash changes better

CaptainObv
  • 360
  • 1
  • 4
  • 15
  • that is what submodules are for. But if you cloned x repos in x folders in a location that is not a git repo, then you'll have to write and run a for cycle to ask git status out of all of them – Daemon Painter Jul 22 '20 at 12:32

1 Answers1

1

You might consider creating scripts that can go into the separate repos and run the separate commands there.

Say you you have micr1 and micro2, 2 separate microservices. You check them out in ~/whole. So locally you have ~/whole/micro1 and ~/whole/micro2. You might have a script called ~/whole/status that looks something like:

#!/bin/bash

for i in micro1 micro2; do
    cd $i
    lines=$( git status --short | wc -l )
    if [ $lines -gt 0 ]; then
        echo Repo $i
        git status
    fi
    cd -

So, being in ~/whole, you simply run:

./status

And you get the status of all projects in a single run.

eftshift0
  • 26,375
  • 3
  • 36
  • 60