Skip to content

Instantly share code, notes, and snippets.

@hqrd
Created March 25, 2020 14:14
Show Gist options
  • Save hqrd/7ffb7916fc6c2fad046d4c4d79b2ce00 to your computer and use it in GitHub Desktop.
Save hqrd/7ffb7916fc6c2fad046d4c4d79b2ce00 to your computer and use it in GitHub Desktop.
This script is used to update all the git repositories in a directory at once
#! /usr/bin/env bash
###
# This script is used to update all the git repositories in a directory at once
###
for dir in ./*/
do
cd ${dir} || exit
git status >/dev/null 2>&1
# check if exit status of above was 0, indicating we're in a git repo
[ $(echo $?) -eq 0 ] && echo "Updating ${dir%*/}..." && git pull
cd ..
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment