Skip to content

Instantly share code, notes, and snippets.

@rishikeshdhokare
Last active June 5, 2018 05:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rishikeshdhokare/0f531eed7bf5ea40c752032c24ce6fd8 to your computer and use it in GitHub Desktop.
Save rishikeshdhokare/0f531eed7bf5ea40c752032c24ce6fd8 to your computer and use it in GitHub Desktop.
git pull all the repositories in a directory
#!/bin/bash
for d in ./*/;
do (
cd "$d" &&
currentDir=`pwd`
echo "updating `basename "$currentDir"`..."
git pull
);
done
@rishikeshdhokare
Copy link
Author

Additionally add an alias for running this file -

Add following at the bottom of .bashrc file
alias git_refresh='cd <directory containing multiple git repositories> && ./git_refresh.sh'

@rishikeshdhokare
Copy link
Author

For iTerm with zsh -
add the alias to .zshrc and source it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment