Last active
November 16, 2017 18:41
-
-
Save jackpot51/f31ab4f32290b1365f9f367a56bed1b6 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
#!/usr/bin/env bash | |
set -e | |
if [ -z "$1" ] | |
then | |
echo "$0 [git repository]" | |
exit 1 | |
fi | |
git clone --bare --recursive "$1" bare | |
git -C bare ls-remote --quiet --heads | cut -d $'\t' -f2 | while read ref | |
do | |
branch="$(basename "$ref")" | |
git clone --recursive bare -b "$branch" "$branch" | |
git -C "$branch" remote set-url origin "$1" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment