Skip to content

By default, target original repository if it's a fork when creating new MR.

Matthias Käppler requested to merge github/fork/jacob-carlborg/mr_target into master

Created by: jacob-carlborg

The workflow we use at work to add new code in our projects is the same as on Github.

  1. Fork the project
  2. Make the changes in a topic branch
  3. Create a merge/pull request for the topic branch

Since most work is done in the forks and the changes should go back to the original repository via merge requests it's a lot more convenient that when creating a new merge request the target repository is by default, if it's a fork, the original repository (upstream). I never had the need to create a merge request from one branch to another in the same repository.

Also the default target branch will be the default branch of the target project. While the default source branch will be the latest created branch in the source project.

The above is achieved by first checking if the source project is a fork, if it is then the original project is used as the target project. If it's not, it falls back to the current behavior.

The target branch is by default selected to be the default branch of the target project. The source branch will be the latest branch in the source project. This is a simple heuristic method based on the idea that the branch that was just created (the latest branch) is the branch one most likely want to use as the source branch.

Merge request reports