Skip to content

Instantly share code, notes, and snippets.

@newmen
Created April 8, 2026 13:17
Show Gist options
  • Select an option

  • Save newmen/f2006c5562b6dda6ad236ad974b566f2 to your computer and use it in GitHub Desktop.

Select an option

Save newmen/f2006c5562b6dda6ad236ad974b566f2 to your computer and use it in GitHub Desktop.
update all repos in the current director
#!/usr/bin/env bash
set -e
ROOT_DIR="${1:-.}"
find "$ROOT_DIR" -type d -name ".git" | while read -r gitdir; do
repo_dir="$(dirname "$gitdir")"
echo "=== Updating $repo_dir ==="
(
cd "$repo_dir" || exit
git checkout master
git pull origin master
)
done
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment