DEV Community

loading...

parallel git pull

joaovitor profile image João Vitor ・1 min read

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

Discussion

pic
Editor guide