I have 2 diffrent remotes
Each origin have a branch with same name. (branch_xxx)
How can i merge "origin1/branch_xxx" changes to "origin2/branch_xxx" using command line
You can't work directly on origin2/branch_xxx
which is not a local branch but a mere image of the last position of branch_xxx
last time you fetched from origin2
(what's called a remote-tracking branch).
What you can do is work on a local copy (3 steps) :
1) Create a local copy of origin2/branch_xxx which will receive the merge
git checkout -b branch_xxx origin2/branch_xxx
2) Then merge origin1/branch_xxx into it (for the source branch no need for a copy)
git merge origin1/branch_xxx
(and deal with potential conflicts as usual)
3) Finally, push the result to origin2
git push origin2 branch_xxx
Note : to have a better understanding of what are these remote-tracking refs and how to work with them, take a look at this excellent summation in the official doc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With