From: Tony Maserati <abletony84@gmail.com>
To: git@vger.kernel.org
Subject: Help creating script that mass-pulls Git(Hub) repos
Date: Sat, 21 Nov 2009 11:25:20 +0100 [thread overview]
Message-ID: <dc191bcd0911210225k3cf946c6k54f1287c818af5a8@mail.gmail.com> (raw)
Hi,
I got a bunch of repos I've cloned off GitHub and I'm looking for the
best way to keep them all up to date.
I got a working zsh script, but it lacks some stuff. For instance I
think it'd be neat if it could output the difference between the
commit dates as oppose to those long hashes. And if it could initiate
the pull only when necessary. Other ideas are welcome.
Does anybody have any suggestions to how I might complete or otherwise
improve the below scripts? Thanks in advance.
Here's the working version:
abletony84$ cat pull_all.sh
#!/usr/bin/env zsh
for folder in $PWD/**/.git(:h); do
cd $folder
git pull
done
-
This script lacks a proper if clause, and shows hashes instead of dates:
abletony84$ cat pull_all2.sh
#!/usr/bin/env zsh
for folder in $PWD/**/.git(:h); do
cd $folder
if this repo needs an update; then # git ls-remote has been suggested
old=$(git rev-parse HEAD)
git pull >& /dev/null
new=$(git rev-parse HEAD)
echo "$folder: $old -> $new"
else
echo "$folder: nothing to do"
fi
done
-
A slightly different approach, even more incomplete than the previous:
abletony84$ cat pull_all3.sh
#!/usr/bin/env zsh
for folder in $PWD/**/.git(:h); do
cd $folder
if repo still exists at github; then
git fetch >& /dev/null
if a merge is needed; then
git merge >& /dev/null
echo "$folder: date_of_last_current_commit -> date_of_last_new_comit"
else
echo "$folder: nothing to do"
fi
fi
done
-
Thanks again!
Tony
next reply other threads:[~2009-11-21 10:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-21 10:25 Tony Maserati [this message]
2009-11-21 15:18 ` Help creating script that mass-pulls Git(Hub) repos Kumar Appaiah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dc191bcd0911210225k3cf946c6k54f1287c818af5a8@mail.gmail.com \
--to=abletony84@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox