Last active
August 28, 2018 09:22
-
-
Save schwuk/983f4cc5bd9d87ee0f3d58d09d04b987 to your computer and use it in GitHub Desktop.
Simple shell script to update all git repositories in a directory. Requires the `lockfile` utility from Procmail.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Updates git repositories | |
LOCKFILE=/tmp/git.lock | |
lockfile -r 0 $LOCKFILE || exit 1 | |
GIT=`which git` | |
for i in `ls`; do | |
echo $i | |
cd $i | |
if [[ -e .git ]]; then | |
git fetch --all --prune | |
git pull | |
fi | |
cd - | |
done | |
rm -f $LOCKFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment