Skip to content

Instantly share code, notes, and snippets.

@MarkWarneke
Created July 19, 2020 11:02
Show Gist options
  • Save MarkWarneke/6a000ed9f3134b838297076a257f2224 to your computer and use it in GitHub Desktop.
Save MarkWarneke/6a000ed9f3134b838297076a257f2224 to your computer and use it in GitHub Desktop.
A quick and dirty folder based script to pull & prune all repositories in the current folder
#!/bin/bash
BASEDIR=$(sh -c pwd)
for foldername in */; do \
cd $foldername && \
branch=$(git rev-parse --abbrev-ref HEAD) && \
echo "======= Pulling $foldername --- branch: $branch =======" && \
git pull && \
git remote prune origin
cd $BASEDIR
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment