DEV Community

rafaone
rafaone

Posted on

Updating repository recursively

Many use systems like GitHub and BitBucket, but some companies have their own repository structure in directory mode.

So imagine that a devops backs up a directory called repos where it has all the versioned projects and the dev has this copy but needs to update it.

cd repos

for i in */.git; do ( echo $i; cd $i/..; git fetch origin; ); done;

You can change your command there with your need, if it were mercurial easily adapted to

for i in */.hg; do ( echo $i; cd $i/..; hg update; ); done

Top comments (0)