Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure DevOps - Pull Request Git "Next steps: Manually resolve these conflicts and push new changes to the source branch."

I have created a branch named dev.

I have done a pull request to send dev code to master, when I do this pull request it tell me: enter image description here

50+ conflicts prevent automatic merging "Next steps: Manually resolve these conflicts and push new changes to the source branch."

Where do I go from here? I just want all the dev branch to replace whatever is in master. I see no options to resolve these conflicts.

like image 891
CBBSpike Avatar asked Jan 21 '18 21:01

CBBSpike


People also ask

How do I resolve conflict in Azure DevOps pull request?

Select the Conflicts link to start resolve file conflicts. This will bring up a list of files with conflicts. Selecting a file lets you accept the changes in the source branch you're merging from with the Take Source button or accept the changes in the branch you're merging into using Keep Target.

What is pull and push request in Azure DevOps?

Pull requests (PRs) are a way to change, review, and merge code in a Git repository on Azure Repos. PRs can come from branches within the same repository or from branches in forks of the repository. Teams use PRs to review code and give feedback on changes before merging the code into the main branch.

How do I use Azure DevOps pull request?

From the Pull Requests view, select New Pull Request. Select the source and target branches, enter a title and optional description, and select Create. After the PR is created, select Open in browser to open the new PR in the Azure DevOps web portal.


3 Answers

You will have to do the following on your PC

On branch dev

$ git pull --no-rebase origin master - This will create a merge commit and you will have to resolve the conflicts in the files which are changed both on dev and master. git status will show the list of files with conflicting changes.

After resolving conflicts, commit all the changes and push your branch. After that you should be able to complete the PR.

FYI: --no-rebase makes sure that a merge is done even if the pull behavior is overwritten to default to rebase.

Help link for more details

like image 147
Harshil Lodhi Avatar answered Oct 16 '22 19:10

Harshil Lodhi


Since you need to keep the files version on dev branch (keep the source branch while changing files in target branch master), so you should make changes on master branch to resolve the conflict files, and be sure you have permission to push changes to master branch.

You can use below options:

Option 1: merge directly

In your local repo, you can execute below commands to merge dev into master branch while keeping the conflict files version as the dev branch:

git checkout master
git merge dev -X theirs
git push origin master

And in the existing pull request you created, it will shows the branch has been merged. So you can abandon the pull request.

Option 2: still merge via pull request (resolve conflicts on master branch)

You can use below commands to resolve conflicts in master branch:

# In yout local repo
git checkout master
git checkout dev -- .
git commit -m 'replace master branch version by dev for the conflict files'
git push origin master 

While the changes in existing pull request won’t be updated if new commit(s) pushs to the target branch (master). And you can find the similar report Pull request diff does not update when a commit from the PR is merged to the target via another branch.

That means, the pull request in the web page still show the conflicts. You should abandon the existing pull request and reactivate (or create a new one) to merge dev into master branch.

like image 5
Marina Liu Avatar answered Oct 16 '22 17:10

Marina Liu


I had to do a rebase. Had to walk through all the commits and apply my changes - they were pretty extensive, renaming namespaces & method names, etc. This then let me continue to do a Pull Request in the Azure DevOps portal. Actually, I could just Refresh changes for the existing Pull Request and the auto merge conflicts were resolved.

Merging the code did not resolve the issue, only rebase worked.

like image 2
Scott Koland Avatar answered Oct 16 '22 17:10

Scott Koland