Last active
January 24, 2018 11:03
-
-
Save erkekin/f10573cad22f5a37e02c2d6f4a63f83f to your computer and use it in GitHub Desktop.
Fetches all branches of different git repositories in a directory
This file contains 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
# Creat a directory called all-repos, and clone all projects into it. | |
mkdir all-repos | |
cd all-repos | |
git clone THEPROJECT1-GIT-ADDRESS project1 | |
git clone THEPROJECT2-GIT-ADDRESS project2 | |
. | |
. | |
. | |
# Create a shell script file called fetchall.sh in the all-repos directory | |
vi fetchall.sh | |
#paste the code below | |
#!/bin/bash | |
for branch in `git branch -r | grep -v HEAD | grep -v master`; do | |
echo ${branch##*/} $branch | |
done | |
git fetch --all | |
git pull -v | |
# end | |
# run this to fetch all branches of folders in "all-repos" directory | |
for d in ./*/*/ ; do (cd "$d" && cp ../../fetchall.sh . && sh fetchall.sh && rm fetchall.sh); done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment