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)

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay