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 <[email protected]> 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 [email protected]
To get help send a blank message to [email protected]
To visit the archives: https://lists.linux-ottawa.org

Reply via email to