Skip to content

Instantly share code, notes, and snippets.

@ollynevard
Forked from douglas/update_git_repos.sh
Last active July 2, 2020 17:15
Show Gist options
  • Save ollynevard/5269354 to your computer and use it in GitHub Desktop.
Save ollynevard/5269354 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Store the current directory
current_directory=$(pwd)
# Setup colours
c_reset='\033[00m'
c_highlight='\033[33m'
echo -e "\n${c_highlight}Pulling in latest changes for all repositories...${c_reset}"
# Find all git repositories
for i in $(find . -name ".git" | cut -c 3-); do
# Change the repository directory.
cd "$i/..";
echo -e "\n${c_highlight}${PWD##*/}${c_reset}";
# Update repository.
git pull origin;
# Back to current directory.
cd $current_directory
done
echo -e "\n${c_highlight}Complete!${c_reset}\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment