Multi-gitter – CLI to update multiple Git repositories in bulk
1–9 of 9 posts
Re: Multi-gitter – CLI to update multiple Git repositories in bulk
#2Re: Multi-gitter – CLI to update multiple Git repositories in bulk
#3Re: Multi-gitter – CLI to update multiple Git repositories in bulk
#4 #!/usr/bin/env bash
if [ $# -lt 1 ]
then
echo "$0: error: missing arguments"
echo "usage: $0 "
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 bulk
#5This 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 bulk
#6This 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 ?
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 bulk
#7Re: Multi-gitter – CLI to update multiple Git repositories in bulk
#8This 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 ?
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.
Re: Multi-gitter – CLI to update multiple Git repositories in bulk
#9Example from the man page:
git for-each-repo --config=maintenance.repo maintenance run
[0]:https://gitirc.eu/git-for-each-repo.html