Sujet : Re: Git automation
De : fritz (at) *nospam* spamexpire-202505.rodent.frell.theremailer.net (Fritz Wuehler)
Groupes : comp.os.linux.miscDate : 04. May 2025, 01:37:42
Autres entêtes
Organisation : dizum.com - The Internet Problem Provider
Message-ID : <6dd231eebff2c27d33e43d6f004f581c@msgid.frell.theremailer.net>
References : 1
The Doctor <
doc...@doctor.nl2k.ab.ca> [TD]:
TD> How can i cron a script so that the git pull can be run in the
TD> subdirectories with a .git subdirectory , ogin to the next one
TD> until done and report results in e-mail ?
# get a list of directories with .git
find "/path/to/" -type d -name '.git' -print0 |
# prepare a bunch of shell commands
xargs -0 --replace=MY_GIT_DIR \
echo '(D='MY_GIT_DIR';
cd "$D" && echo Working in "$D";
git pull your_git_options_here;
)' |
# execute them sequentially
sh 2>&1 |
# and send their output somewhere by email
mail -s 'git jobs output'
me@example.com