Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save lionslair/5d8d74e7efb9c1cfdd804c11e12454bf to your computer and use it in GitHub Desktop.

Select an option

Save lionslair/5d8d74e7efb9c1cfdd804c11e12454bf to your computer and use it in GitHub Desktop.
Simple bash script for fetching and pulling all repos in the executed folder to the latest of the branch they are on
#!/bin/bash
REPOSITORIES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
IFS=$'\n'
for REPO in `ls "$REPOSITORIES/"`
do
if [ -d "$REPOSITORIES/$REPO" ]; then
cd "$REPOSITORIES/$REPO"
echo "Updating $REPOSITORIES/$REPO at `date`"
git status
echo "Fetching"
git fetch
echo "Pulling"
git pull
echo "Done at `date`"
echo
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment