Skip to content

Instantly share code, notes, and snippets.

@Sharaf5
Forked from Calinou/update-git.sh
Created July 8, 2023 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sharaf5/3efb37a058eae94507e5e484ec05ac4d to your computer and use it in GitHub Desktop.
Save Sharaf5/3efb37a058eae94507e5e484ec05ac4d to your computer and use it in GitHub Desktop.
Updates all Git repositories in a directory
#!/bin/bash
# Copyright (c) 2015 Calinou
# CC0 1.0 Universal
# <https://creativecommons.org/publicdomain/zero/1.0/>
update() {
for d in "$@"; do
test -d "$d" -a \! -L "$d" || continue
cd "$d"
if [ -d ".git" ]; then
echo -e "\e[1;36m$PWD\e[0m"
git pull
fi
cd ..
done
}
update *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment