I have a main repository which contains some sub-repos:
- main repo A – branch “master”
- child repo B – branch “master”
- child repo C – branch “master”
If I change something in repo C, I make a new branch in repo C and push the changes in repo C. I also have to push the +1 diff of repo C in the main repo A.
Then it looks like this:
- main repo A – branch “develop” (develop branch contains the +1 diff)
- child repo B – branch “master” (nothing changed here)
- child repo C – branch “develop” (change was pushed to develop branch)
I have already written a fine working bash script which resets my child repos to the commit of the main repo.
-c "git fetch -f --all --tags --prune && git submodule foreach git fetch -f --all --tags --prune && git checkout -f -B master && git reset --hard {sHashes} && git submodule update --init --recursive && git submodule foreach git checkout -f -B master"
But this script checks out the master branch everywhere. I want to change it so that the script checks out the related branches of the child repos too! Not just the commits.