One Product can have multiple Product Branches. On Product Branches detail view, there will be link field of the parent Product. And on the Product detail view, there will be sub-panel which will display related Product Branches.
How can I implement this relation?
while searching product code, the one should get branches information too if product code will match with branches.
You can do this from Module Builder (create the new Product branches module) and then from Studio (add a one-to-many or a many-to-many relationship between Products and Product branches). This will create the subpanel automatically. You might need some extra customizations to get everything right.