home | list info | list archive | date index | thread index

Re: update all git repos

It would seem Dianne Skoll, on Tue, Feb 16, 2021 at 07:43:44PM -0500, wrote:
> On Tue, 16 Feb 2021 19:33:34 -0500
> James <bjlockie [ at ] lockie [ dot ] ca> wrote:
> 
> > $ find /hdd-storage/storage/programming/ -maxdepth 1 -type d -exec
> > "cd {}; git pull" \;
> 
> "cd" is a shell builtin.  You can't exec it as a program.
> 
> Try:
> 
> find /hdd-storage/storage/programming -type d -maxdepth 1 -exec /bin/bash -c 'cd {} && git pull' \;

I guess using git -C option to specify path would be simpler, and
marginally more portable.

I'd probably do something like:

find /path/to/root -type d -name .git -exec git -C \{\}/.. pull \;

This has the advantage of syncing nested gits (if there are any), though
you might want to use maxdepth if your source trees are complex.

For that matter, you might want to look at git submodules.

-Ross

To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org

references

message navigation