I am trying to automate a recurring workplace scenario.
I have a repo myRepo
which contains a submodule mySub
. I create a new branch for myRepo
called myRepoBranch
and also a new branch for mySub
called mySubBranch
. I commit changes in both branches and submit them for a pull request.
Issues arise where code in myRepoBranch
directly depends on code in mySubBranch
. If after submitting my pull request I checkout master and run git pull
and git submodule update
, mySub
will no longer point to mySubBranch
. This behaviour is expected and is perfectly fine for master. But if I need to checkout myRepoBranch
again, I will also have to manually checkout mySubBranch
for the submodule.
Is there a way to automate this manual submodule checkout? Is it possible to bind a specific submodule branch to a specific main repo branch?