Reputation: 161
I'm looking for steps to push feature branch on repository A to master branch of repository B using command line steps on azure DevOps build pipeline. Thanks
Upvotes: 2
Views: 5243
Reputation: 161
apparently, in the comments. everything command is coming as single line. So, here it is again.
here, is the git commands which fixed the ask for me.
git clone -b feature/feature-test --single-branch
git checkout -b master
git remote add origin-feature
git push origin-feature master
Upvotes: 0
Reputation: 51103
The simplest way is through Pull Request. But it depends if there exist Fork relationship between current(repoA) and target(repoB) repos.
In other word, one repos must be forked from another repos if you want to create pull request across repos.
At this time, you will has option to choose another repos/project while you creating the Pull request.
More details please take a look at the answer in this question: Azure DevOps : Pull Request across the Repositories?
Otherwise you need to use multiple git commands to achieve this:
Separately Clone the repoA and repoB to your local machine.
git clone {repo urla}
git clone {repo urlb}
Go to the local repo and move to the feature branch.
git checkout {feature branch}
Ctrl+A
, Ctrl+C
.Move back to master branch in repoB.
git checkout master
Ctrl+V
.Commit the changes.
git add .
git commit -m "update master"
Push the changes to remote repoB inAzure DevOps .
git push
Now the master
branch updated with the content of the feature branch
.
Besides, you could also try to use this 3-rd party extension --Git Merge in marketplace.
Test merges for conflicts between git branches OR actual merge commit and push of two git branches
Upvotes: 1