I have a repo X (let us assume it has branches XB1, XB2, and I have checked out branch XB1). I have added a submodule Y (let us assume this submodule has branches YB1, YB2). I have added the submodule Y (branch YB1) in X.
Is there a way to add branch YB2 as submodule in branch XB2?
In summary, what I am looking for is that when I checkout XB1, I want to use YB1 and when I checkout XB2 I want to use YB2.
Not sure if the above is possible in git, but thought of asking.