My project contains a submodule submodA. For the branch_dev the origin url of the submodule links to sub_dev which is a fork of sub_master but where I can apply modification and commit. For the branch_master the origin url of the submodule links direclty to sub_master
branch_dev/submodA--origin-> sub_dev --fork--> sub_master
master_dev/submodA--origin-> sub_master
By doing like this, I can clone branch_dev and find automatically the modification I did in sub_dev using git submodule update --init --recursive.
My problem is that the origin url of submodA which is different between my two branches doesn't change automatically and I have to change manually in the submodule the origin url with git remote set-url origin sub_dev or sub_master.
Does it have a solution to automatically change the origin url of my submodule when switching between branches ? I may try something too complicated so I would also be glad to here others solutions for my situation.