We use TFS 2017 (15.117.26714.0) with git. When we try to make a pull request, TFS says "Pull request cannot be automatically merged.".
I'm just trying to figure out what's happening but I didn't find any message on why the pull request cannot be automatically merged.
Do you know how to debug "Pull request cannot be automatically merged."? Is there a hidden option or a link to a log that can help me?
Update
You can find a little report about the job that is supposed to execute the merge during the pull request on a dedicated page of the web server. You can find it in http://my.tfs.server:8080/tfs/_oi or https://my.tfs.server/_oi then search for a job named Git Native MergeJob
. You must have administrative rights to access it.
This provides a result message for that job which can be an exception with a callstack if the job has failed.
However, in my specific case, the job is executed successfully and the result message is Successfully tried merging.
while the message from the pull request is still Pull request cannot be automatically merged
.
So, I need to dig deeper and find a log (if it exists!) of that specific job. Anyone knows where I can find it?
Git is very good at automatically merging file changes in most circumstances, most pull requests can be "automatically merged" which means there are no conflicts between it and the target branch.
However, if somebody else makes a change to one of the same files as you TFS will no longer attempt to merge your branch. If TFS could not offers suggestions on how to correct this. You may get this kind of error info "Pull request cannot be automatically merged."
You could double check this by pull down the two server branches to local and compare with each other. If there some conflicts, suggest you take a look at resolve merge conflicts.
Some similar issue for your reference:
- GitHub "can't automatically merge"?
- What do I do when my Pull Request does not merge automatically in master?
Besides, to avoid this kind of issue, you could set up the branch policy to protect your branch. After you set up a branch policy, others cannot directly push changes to the branch. Changes to the branch are only made through pull requests.
Means you don't have the latest master.
You're supposed to pull the latest master, merge it into your feature branch fixing all conflicts, then do your pull request.
You can find a little report about the job that is supposed to execute the merge during the pull request on a dedicated page of the web server. You can find it in http://my.tfs.server:8080/tfs/_oi
or https://my.tfs.server/_oi
then search for a job named Git Native MergeJob
. You must have administrative rights to access it.
Depending on what the issue is, you may have the exception and a callstack that can help understand why "Pull request cannot be automatically merged".
Most of the time, you'll find that a file is "too big" to be handled by TFS, see this issue on github.
来源:https://stackoverflow.com/questions/48526383/how-to-debug-pull-request-cannot-be-automatically-merged-in-tfs