Created
October 8, 2015 14:48
-
-
Save Rhernandez513/fdf746ccae0e845399b4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # update_repos - A simple script to update git repos within a directory | |
| # Location where this script is stored in the filesystem | |
| # STARTDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |
| # Location of the working directory of the calling shell | |
| PARENTDIR=$PWD | |
| # Convert from HTTPS to SSH access for cloned repos | |
| for i in */; do | |
| sed -i 's/https\:\/\/github.com\//[email protected]\:/' "$i/.git/config" | |
| done | |
| # Cycles into each directory where the script is called from and updates | |
| echo "Script called from $PARENTDIR" | |
| for DIR in */; do | |
| cd "$DIR" | |
| echo "Updating: $DIR" | |
| git fetch | |
| git pull | |
| cd "$PARENTDIR" | |
| done | |
| # EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment