DEV Community 👩‍💻👨‍💻

João Vitor
João Vitor

Posted on • Updated on

Update git repos in parallel

Are you living in a microservices world?
Do you need to keep multiple git repositories in sync?

How much time would it take to update 63 repositories?

The update-repos.sh script uses gnu-parallel and execute the git pull --rebase and git fetch --prune in parallel.

Update repositories in parallel

cd ~/github-orgs/PacktPublishing
time update-repos.sh
Enter fullscreen mode Exit fullscreen mode

Output:

[truncated]
job 56 completed ./Develop-and-Operate-Microservices-on-Kubernetes
Already up to date.
job 55 completed ./DevOps-Puppet-Docker-and-Kubernetes
Already up to date.
job 62 completed ./-Kubernetes-for-Absolute-Beginners---Hands-on
[truncated]

real    0m9,083s
user    0m6,321s
sys     0m2,668s
Enter fullscreen mode Exit fullscreen mode

If you do that synchronously it would have taken near 4 minutes.

real    4m53,583s
user    0m6,480s
sys     0m4,776s
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

All DEV content is created by the community!

Hey, if you're landing here for the first time, you should know that this website is a global community of folks who blog about their experiences to help folks like you out.

Sign up now if you're curious. It's free!