145

In Azure Repos, I have created a PR from branch A to branch B. There aren't any merge conflict displayed. But I end up with the warning message

Warning: Multiple merge bases detected. The list of commits displayed might be incomplete.

Screenshot of error

What does this mean?

Jim Aho
  • 9,932
  • 15
  • 56
  • 87
Janani
  • 1,559
  • 2
  • 5
  • 5
  • 24
    We are seeing this for the first time today as well. – JohnOpincar Sep 16 '21 at 18:52
  • I can't speak to or for Azure in any way, but multiple merge bases are normal (or normal-ish: they're normal but *rare*) when looking at branches: they occur as a result of criss-cross merges, for instance. – torek Sep 16 '21 at 21:28
  • 1
    Can you give more details? Such as what did you do in the branch A? – Bowman Zhu-MSFT Sep 17 '21 at 02:09
  • @BowmanZhu-MSFT We started having the same problem yesterday too, even on PR older than 30 days. If I branch master, make some changes and create a PR there is no message. If another PR is merged in the target branch while my PR is not completed the error appears. Never happened before yesterday and happens in every PR from yesterday – gmazzotti Sep 17 '21 at 08:16
  • 5
    We're suddenly getting this too on ADO on long-lived branches where this warning has never been seen before. I've run a few tests and am not seeing anything untoward: Commit history is maintained correctly, changes merged in fine. @BowmanZhu-MSFT this is definitely an issue introduced in ADO in the last 24 hours – Ive Sep 17 '21 at 10:31
  • 2
    Some additional info at this Microsoft Developer Community link: https://vsf-prod.westus.cloudapp.azure.com/content/problem/1530780/receiving-warning-multiple-merge-bases-detected-th.html – GaTechThomas Sep 24 '21 at 14:21
  • 2
    @Janani Could you please add your actual question about this affair? Is your question "why does this happen" or is it "how do I fix it"? – MC Emperor Feb 24 '22 at 13:34
  • What is the question? – Peter Mortensen Aug 19 '22 at 19:04
  • 1
    It seems that as of today 113 people understand the implied question: "Why is this error occurring?" – GaTechThomas Aug 19 '22 at 22:48
  • 115 and possibly counting, the question is very clear for me - "WTF MS is displaying here???", though agree that it is implied which might not be enough for purists ;) – Andrzej Martyna Sep 01 '22 at 11:54
  • @GaTechThomas ... while the highest voted answer doesn't care about the reasons. An actual question _is_ helpful. – Eike Oct 06 '22 at 11:37

10 Answers10

68

I got the same message today. I just pulled the latest changes from the destination branch and merged them in the source branch and the issue was resolved.

Jorn.Beyers
  • 1,784
  • 2
  • 21
  • 26
  • 6
    This way I need to go back every time and see if there are new changes on the destination branch and merge it. There should be a better way though. – Ajay Sharma Sep 17 '21 at 13:54
  • 2
    Correct, specially when testing things it's worth to pull in the latest changes. I don't agree with you there should be a better way. This just works fine in my opinion. – Jorn.Beyers Sep 17 '21 at 19:13
  • 3
    If another PR is merged in destination branch the message reappears and you must pull last changes in every PR waiting. This isn't a feasible approach in my opinion. – gmazzotti Sep 17 '21 at 20:50
  • 1
    This worked for me as well. – etrupja Sep 19 '21 at 11:12
  • But that would mean that my master branch got some kind of shadow update which should not be possible due to branch policies in place – Ino van den Berg Sep 20 '21 at 13:00
  • I get the same warning message when creating the PR for destination branch into the source branch. This is happening on our release branches: beta -> master. We only ever merge beta into our master branch, we've never seen this before when merging to master, but now see it in all 3 of our repositories when merging to master. – jrpharis Sep 22 '21 at 02:55
  • 1
    @Jorn.Beyers but there’s one problem in this approach. Just imagine your source feature branch is taken out of a branch named as branch1 and you have raised PR to merge from feature branch to a branch named as branch2, in that case you may get changes done by other developers from branch2 to feature branch , and the. If your try to raise PR to merge from feature branch to branch1. You will get unwanted changes. which could not be supposed to go in branch1. So this is just a warning, better way is to resolve the merge conflict in such situations. – Vivek Nuna Sep 24 '21 at 20:19
  • 2
    In my case, this didn't help. Merging from destination to source showed me the message "There are no changes to merge between the selected branches.", but still I am getting the warning "Warning: Multiple merge bases detected. The list of commits displayed might be incomplete" So, what can I do in this case? – Matt Sep 29 '21 at 09:17
20

Just take the latest changes of the destination branch to the source branch and complete the merge. After that this message will not come up on the pull request page.

In my opinion, this is good that Azure DevOps is giving such a warning, so that if you forgot to take the latest from the target branch before finishing your pull request, it may save some time or end moment rush & surprise.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JARVIS
  • 765
  • 1
  • 8
  • 28
  • 5
    Yup - They should have just made it clearer. Literally adding that "Hey, did you forget to sync against latest remote or..?" to the message. – Ran Sagy Sep 22 '21 at 15:09
  • 1
    but it has also Merge conflicts message when some merge conflicts are detected. so this warning about multiple bases is useless. – Juri Sep 24 '21 at 14:35
  • 1
    That wasn't the solution in my case. See the comment I made to @Jorn.Beyers answer. – Matt Sep 29 '21 at 09:19
  • The part after *"save some time"* is incomprehensible. Can you [fix](https://stackoverflow.com/posts/69255215/edit) it? (But ***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today.) – Peter Mortensen Aug 19 '22 at 19:09
  • Except that "sync" is not even a term in git, but a design smell from another VCS which makes people never understand git – Jim Aho Oct 21 '22 at 05:21
  • In my case the conflicting commit was made 20 minutes before my PR, so despite my fastidious efforts to merge the latest changes it didn't help. The advice to "complete the merge" is what helped but only after the fact. – Mark Ransom Feb 21 '23 at 19:41
10

Take this warning seriously. This happens either

  • When your source branch doesn't have the latest destination branch and you have created the pull request.

  • Or you have merged a branch which is not the origin of your current branch.

    Enter image description here

For the first reason: Take your branch to local, merge the origin of the destination branch to your branch, commit and push. Check the PR now. It must be resolved now. If not, then you must check the second reason.

For the second reason: When you have pushed a branch to your current branch which is not the origin of your current branch.

  • The best solution, if feasible in your case, is to identify the branch which was not the origin of your branch and revert the commit and push it.
  • If not, then create a new branch from the origin of the destination, cherry pick all the commits which are relevant and commit push. Create a new PR from this new branch.

Choose the option based on your feasibility.

Sylvain Rodrigue
  • 4,751
  • 5
  • 53
  • 67
KushalSeth
  • 3,265
  • 1
  • 26
  • 29
8

I had this happen to multiple teammates today. It was occurring because they were about to merge a PR into our main branch before merging that main (remote) branch into their (local) branch first. Their local branch was several commits behind.

Once they merged, committed, and pushed, the message disappeared.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
T H
  • 492
  • 5
  • 15
6

If I am correct, this warning is useless, because Azure DevOps also has a feature to detect merge conflicts. And I am getting this warning no matter if there are any conflicts or not:

Enter image description here

If there are merge conflicts detected, then I get this one:

Enter image description here

So I would say the proper way to handle merges is by automatic build pipeline, not a warning that confuses everybody.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Juri
  • 3,389
  • 1
  • 20
  • 16
  • 1
    The warning is saying that the list of commits may be incomplete, this is not the same as merge conflicts. seeing that warning from the OP does not mean there is a merge conflict, I have got the warning without any conflict. it generally happens with criss-cross merges (e.g. I create a feature branch against latest version, then I do a hotfix against old version and merge the fix into my release branch for latest version). in these complex cases then Azure DevOps can't guarantee its list of commits being merged is correct – Adam Burley Sep 24 '21 at 15:35
  • So I guess the warning should be visible only on the Commits tab? and there is something wrong with coloring of that warning. Also, we are working only on develop, with multiple feature branches being completed in various order, and still seeing this warning all the time actually. – Juri Sep 27 '21 at 10:04
  • In our small project team consisting of 5 developers with multiple PRs at the same time I basically get this warning on every PR. Have been seeing that for a month already and I want to confirm that this warning is useless to me. – Juri Oct 15 '21 at 16:30
  • Please review *[Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/)* (e.g., *"Images should only be used to illustrate problems that* ***can't be made clear in any other way,*** *such as to provide screenshots of a user interface."*) and [do the right thing](https://stackoverflow.com/posts/69316870/edit) (it covers answers as well). Thanks in advance. – Peter Mortensen Aug 19 '22 at 19:14
  • The message can be ignored in some cases, but it is also possible to be a problem. In some cases, as it has been outlined by other answers, a merge can produce an unwanted result and this message by the OP warns the user about it. – Simon Lang May 31 '23 at 08:55
1

I've found I get the message when I pull updates from another branch into the branch I’m trying to merge (update development branch from master and then PR merge back into master, for example).

I've also found this when I’ve forgotten to pull down changes before pushing updates.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
newky2k
  • 419
  • 5
  • 12
1

This can sometimes happen if your merge is set to "fast-forward" when you have more than one branch implicated, as per the message.

If there are no other conflicts (check Conflicts tab) then you can probably allow the merge to Complete, by selecting (from "..." menu) Restart Merge, then choosing the non fast-forward merge option.

MikeW
  • 5,504
  • 1
  • 34
  • 29
  • I think this is my problem. I did a PR from dev-branch to qa-branch and got this message. I was able to abandon and do master to qa-branch without any issues (which reminded me from where the qa-branch was created from). So, to ensure that I can do dev-branch to qa-branch and not get the error, I should simply change the merge option next time? I really need this to go from dev-branch to qa-branch and not master. – TechFanDan Mar 21 '22 at 12:29
  • 1
    From what you say, that should work. – MikeW Mar 22 '22 at 13:14
1

Me and my colleague had the same issue using Azure DevOps. His branch was behind, and all we had to do was:

git pull origin master

from his local branch. This fixed it.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
DrFaraday
  • 87
  • 1
  • 13
1

This is Azure's way of alerting you to verify and make sure you have not neglected to merge a pull request; it typically occurs when you have an abandoned pull request in the source branch or a previous branch in the tree.

Elizabeth
  • 176
  • 2
  • 10
1

I had to merge latest 'main' in to my 'features/x' branch. The 'features/x' branch was protected, requiring a pull request. The PR had to be completed with fast forward merge. I was trying squash merge, and the 'features/x' branch was not picking up the full commit history. Turns out the directionality of squash merge is something to pay close attention to.

cchapin
  • 180
  • 1
  • 11