-
-
Save ingydotnet/1027fbd332d91b9047ad to your computer and use it in GitHub Desktop.
Refactored to this script
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 -ex | |
rm -fr p1 p2 lib lib.git | |
( | |
mkdir lib p1 p2 | |
git init --bare lib | |
git init p1 | |
git init p2 | |
) | |
( | |
git clone lib lib.git | |
cd lib.git | |
touch readme | |
git add readme | |
git commit -m "Initial lib" | |
git push | |
) | |
( | |
cd p1 | |
touch p1 | |
git add p1 | |
git commit -m "Initial" | |
git subrepo clone ../lib lib -b master | |
) | |
( | |
cd p2 | |
touch p2 | |
git add p2 | |
git commit -m "Initial" | |
git subrepo clone ../lib lib -b master | |
) | |
( | |
cd p1 | |
echo "p1 initial add to subrepo" >> lib/readme | |
git add lib/readme | |
git commit -m "p1 initial add to subrepo" | |
git subrepo push --all | |
) | |
( | |
cd p2 | |
git subrepo pull --all | |
echo "p2 initial add to subrepo" >> lib/readme | |
git add lib/readme | |
git commit -m "p2 initial add to subrepo" | |
git subrepo push --all | |
) | |
( | |
cd p1 | |
git subrepo pull --all -v | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment