News for hackers. Stuff that matters.
Re:Multi-gitter – CLI to update multiple Git repositories in... by _ikke_ on Tuesday June 28, 2022 @09:00AM (#31907109)
git itself has a command called for-each-repo[0], which you provide the name of a global config setting which contains a list of repository paths, and it will then run the specified command on each of those repositories.

Example from the man page:

  git for-each-repo --config=maintenance.repo maintenance run
[0]:https://gitirc.eu/git-for-each-repo.html
Re:Multi-gitter – CLI to update multiple Git repositories in... by skywal_l on Tuesday June 28, 2022 @08:20AM (#31906735)
I have this simple script that I find immensely useful when dealing with multiple git repository present in the same folder:

    #!/usr/bin/env bash
    
    if [ $# -lt 1 ]
    then
      echo "$0: error: missing arguments"
      echo "usage: $0 <command> <args...>"
      exit 1
    fi
    
    for folder in `find . -maxdepth 1 ! -path . -type d`
    do
      if [ -d "$folder"/.git ];
      then
        pushd . > /dev/null
        cd "$folder"
        echo -e '\033[1;32m'
        echo `pwd`
        echo -e '\033[0m'
        "$@"
        popd > /dev/null
      fi
    done
    
In a folder with multiple git repos, you will do something like this:

    $ gitall git status
    [...]
    $ gitall git remote update
    [...]
    $ gitall git rebase origin/master
    [...]
Re:Multi-gitter – CLI to update multiple Git repositories in... by smcleod on Tuesday June 28, 2022 @08:43AM (#31906899)
I actually found mu-repo today which I find much better for my use cases - see https://news.ycombinator.com/item?id=31906227
Re:Multi-gitter – CLI to update multiple Git repositories in... by bilekas on Tuesday June 28, 2022 @08:09AM (#31906652)
This is interesting, but appart from maybe some CI/CD pipeline configurations I can't think of a particularly useful reason for it.. Anyone have some suggestions ?
Re:Multi-gitter – CLI to update multiple Git repositories in... by smcleod on Tuesday June 28, 2022 @08:40AM (#31906876)
Im making small, similar changes across about 30 repos of "microservices", they're a pain the the ass to maintain as they all sit with different owners - I'm not about to make a change in each repo, git add, git commit, push etc.... 30 times over, this makes it easy.

I actually found mu-repo today which is much better for this - see https://news.ycombinator.com/item?id=31906227

Re:Multi-gitter – CLI to update multiple Git repositories in... by markwillis82 on Tuesday June 28, 2022 @08:25AM (#31906766)
I've got ~ 70 git repos to move from AWS code commit to Gitlab and need to tweak config files in each one for the new hosting environment, so this should definitely help
Re:Multi-gitter – CLI to update multiple Git repositories in... by lindellme on Tuesday June 28, 2022 @08:44AM (#31906914)
Some of the most useful runs I've used it for is for refactoring of internal libraries.

Something as simple as wanting to rename a function is theoretically very simple, but if this function is used in hundreds of other repositories, it will be very tedious.

A script that upgrades the dependency + does a replace with sed or similar could be run to make this process way easier.