'Create a branch with its origin path on a different remote repository

Good morning/evening

I have two repos A and B. I'm writing a hook for push events, in some cases I want to create a branch in B based on A.

example:

in A i'm working on main/release1.2/featureAAA/BugABC when i push in A if the push is ok I want to create the branch in repo B BugABC but in the same path main/release1.2/featureAAA.

If the origin branches does not exists in B just exit with an error message

Thank you



Solution 1:[1]

You have to be on branch A first:

git checkout A

and then, you can make a new branch by:

git checkout -b B

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Fuad Zein