Skip to content

Instantly share code, notes, and snippets.

@RiordanIX
Last active September 4, 2021 00:31
Show Gist options
  • Save RiordanIX/f1779c2a94d2e6938f746ed091eb0559 to your computer and use it in GitHub Desktop.
Save RiordanIX/f1779c2a94d2e6938f746ed091eb0559 to your computer and use it in GitHub Desktop.
Update all your git repos in the current directory
#!/bin/bash
###############################################################################
#
# Find all of your git repos in the current directory and pull from each one.
#
# We set maxdepth=2 because we assume we're just looking in this directory for
# repos, and not children directories. This can help with speed if there are
# some deeply imbedded directories with many paths or a crazy tree structure.
###############################################################################
COLOR_CYAN=$'\e[0;36m'
COLOR_NORMAL=$'\e[0m'
COLOR_GREEN=$'\e[0;32m'
for var in $(dirname $(find $(pwd) -maxdepth 2 -name .git -type d -prune))
do
cd "$var"
echo -e "\n${COLOR_CYAN}Pulling in directory:${COLOR_NORMAL} ${COLOR_GREEN}$var${COLOR_NORMAL}"
git pull
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment