Merging via REST API returns 405 - Base branch was modified. Review and try the merge again

Hello,

i am trying to do Pull Request automerging via REST API and a ruby script (using octokit). Sometimes i get the error “405 - Base branch was modified. Review and try the merge again” during merge.

I can not really tell what this means. I am doing several operations before the merge like adding a new commit or setting some checks to successfull. But in general the PR is mergeable.

Has anyone experience with this? Do i have to wait longer before merging because there is some internal processing?

Good question.

Yes, if you’ve noticed that sometimes it takes a second or two for the “this branch can be merged” icon to go green in the GItHub UI, that’s because there’s a process that needs to verify that the branch is mergeable. When you get that message it means that you need to try again because that process hasn’t yet finished.

2 Likes