Created
February 22, 2017 20:45
-
-
Save breezeight/71240bc6aa85b6f23296e0bfa718f9e5 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
#rm -rf parent_repo* child_repo && ./submodules_with_branch.sh | |
set -e | |
if ! [ -d child_repo ]; then | |
mkdir child_repo | |
cd child_repo | |
echo "Hello" > child_message | |
git init -q | |
git add * | |
git commit -q -m "initial commit" | |
# Create a develop branch to show how -b works with submodule | |
git checkout -q -b develop | |
cd .. | |
fi | |
if ! [ -d parent_repo ]; then | |
mkdir parent_repo | |
cd parent_repo | |
echo "hello" > message | |
git init -q | |
git add * | |
git commit -q -m "initial commit" | |
git submodule add -q ../child_repo | |
git commit -q -m "added submodule" | |
cd .. | |
fi | |
# ADD the submodule using the develop branch | |
if ! [ -d parent_repo2 ]; then | |
mkdir parent_repo2 | |
cd parent_repo2 | |
echo "hello" > message | |
git init -q | |
git add * | |
git commit -q -m "initial commit" | |
git submodule add -b develop ../child_repo | |
git commit -q -m "added submodule with branch" | |
cd .. | |
fi | |
git clone -q parent_repo parent_repo_clone | |
git clone -q parent_repo2 parent_repo_clone2 | |
cd child_repo | |
echo "world" >> child_message | |
git commit -q -a -m "second commit" | |
cd .. | |
cd parent_repo_clone | |
git submodule update -q --init --remote | |
git status | |
cd .. | |
cd parent_repo_clone2 | |
git submodule update -q --init --remote | |
#git status | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment