Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
c94a7609
未验证
提交
c94a7609
编辑于
1 year ago
作者:
Amy Qualls
提交者:
GitLab
1 year ago
浏览文件
操作
下载
补丁
差异文件
Finish fact-checking the create-MR page
Process the remaining few subheadings for "create a merge request" for accuracy.
上级
4afb8e6b
No related branches found
No related tags found
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
doc/user/project/merge_requests/creating_merge_requests.md
+68
-49
68 个添加, 49 个删除
doc/user/project/merge_requests/creating_merge_requests.md
有
68 个添加
和
49 个删除
doc/user/project/merge_requests/creating_merge_requests.md
+
68
−
49
浏览文件 @
c94a7609
...
@@ -155,23 +155,50 @@ You can create a merge request by running Git commands on your local machine.
...
@@ -155,23 +155,50 @@ You can create a merge request by running Git commands on your local machine.
You can create a merge request from your fork to contribute back to the main project.
You can create a merge request from your fork to contribute back to the main project.
1.
On the left sidebar, select
**Search or go to**
and find your project.
1.
On the left sidebar, select
**Search or go to**
and find your fork.
1.
Select your fork of the repository.
1.
Select
**Code > Merge requests**
, and select
**New merge request**
.
1.
On the left sidebar, select
**Code > Merge requests**
, and select
**New merge request**
.
1.
For
**Source branch**
, select the branch in your fork that contains your changes.
1.
In the
**Source branch**
dropdown list box, select the branch in your forked repository as the source branch.
1.
For
**Target branch**
:
1.
In the
**Target branch**
dropdown list box, select the branch from the upstream repository as the target branch.
You can set a
[
default target project
](
#set-the-default-target-project
)
to
1.
Select the target project. (Make sure to select the upstream project, rather than your fork.)
change the default target branch (which can be useful if you are working in a
1.
Select a branch from the upstream repository.
forked project).
NOTE:
If you contribute changes upstream frequently, consider setting a
[
default target project
](
#set-the-default-target-project
)
for your fork.
1.
Select
**Compare branches and continue**
.
1.
Select
**Compare branches and continue**
.
1.
Select
**Create merge request**
.
1.
Select
**Create merge request**
. The merge request is created in the target project,
not your fork.
After your work is merged, if you don't intend to
After your work merges,
[
unlink your fork
](
../repository/forking_workflow.md#unlink-a-fork
)
make any other contributions to the upstream project, you can
from its upstream project if you don't intend to make more contributions.
[
unlink your fork
](
../repository/forking_workflow.md#unlink-a-fork
)
from its upstream project.
For more information,
[
see the forking workflow documentation
](
../repository/forking_workflow.md
)
.
For more information,
[
see the forking workflow documentation
](
../repository/forking_workflow.md
)
.
### Set the default target project
By default, merge requests originating from a fork target your fork, not the upstream project.
If you frequently contribute back to the upstream project, and want to target it
by default, change the default target for your fork.
Prerequisites:
-
You're working in a fork.
-
You must have at least the Developer role, or be allowed to create merge requests in the project.
-
The upstream project allows merge requests to be created.
-
The
[
visibility settings
](
../../public_access.md#change-project-visibility
)
for
the fork must match, or be less strict than, the upstream repository. For example:
this setting isn't shown if your fork is private, but the upstream is public.
To do this:
1.
On the left sidebar, select
**Search or go to**
and find your project.
1.
Select
**Settings > Merge requests**
.
1.
In the
**Target project**
section, select the option you want to use for
your default target project.
1.
Select
**Save changes**
.
## By sending an email
## By sending an email
You can create a merge request by sending an email message to GitLab.
You can create a merge request by sending an email message to GitLab.
...
@@ -179,60 +206,41 @@ The merge request target branch is the project's default branch.
...
@@ -179,60 +206,41 @@ The merge request target branch is the project's default branch.
Prerequisites:
Prerequisites:
-
The merge request must target the current project, not an upstream project.
-
A GitLab administrator must configure
[
incoming email
](
../../../administration/incoming_email.md
)
.
-
A GitLab administrator must configure
[
incoming email
](
../../../administration/incoming_email.md
)
.
-
A GitLab administrator must configure
[
Reply by email
](
../../../administration/reply_by_email.md
)
.
-
A GitLab administrator must configure
[
Reply by email
](
../../../administration/reply_by_email.md
)
.
-
You must have at least the Developer role, or be allowed to create merge requests in the project.
To create a merge request by sending an email:
To create a merge request by sending an email:
1.
On the left sidebar, select
**Search or go to**
and find your project.
1.
On the left sidebar, select
**Search or go to**
and find your project.
1.
Select
**Code > Merge requests**
.
1.
Select
**Code > Merge requests**
.
1.
I
n
the
upper-right corner
, select
**Email a new merge request to this project**
.
1.
I
f
the
project contains any merge requests
, select
**Email a new merge request to this project**
.
An email address is displayed. Copy this address.
1.
In the dialog, copy the email address shown. Keep this address private. Anyone who
Ensure you keep this address private
.
has it can create issues or merge requests as if they were you
.
1.
Open an email and compose a message with the following information:
1.
Open an email and compose a message with the following information:
-
The
**To**
line is the email address you copied.
-
The
**To**
line is the email address you copied.
-
The
s
ubject
line
is the source branch name.
-
The
**S
ubject
**
is the source branch name.
-
The
message body
is the merge request description.
-
The
body of the email
is the merge request description.
1.
Send the email message.
1.
To add commits, attach
`.patch`
files to the message.
1.
Send the email.
A merge request is created.
A merge request is created.
### Add attachments when creating a merge request by email
### Add attachments when creating a merge request by email
You can add commits to a merge request by adding
Add commits to a merge request by adding patches as attachments to the email.
patches as attachments to the email. All attachments with a file name ending in
`.patch`
are considered patches and are processed
ordered by name.
The combined size of the patches can be 2 MB.
-
The combined size of the patches must be 2 MB or less.
-
To be considered a patch, the attachment's file name must end in
`.patch`
.
If the source branch from the subject does not exist, it is
-
Patches are processed in order by name.
created from the repository's HEAD or the specified target branch.
-
If the source branch from the subject does not exist, it is
You can specify the target branch by using the
created from the repository's
`HEAD`
, or the default target branch.
[
`/target_branch` quick action
](
../quick_actions.md
)
. If the source
To change the target branch manually, use the
branch already exists, the patches are applied on top of it.
[
`/target_branch` quick action
](
../quick_actions.md
)
.
-
If the source branch already exists, patches are applied on top of it.
## Set the default target project
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/58093) in GitLab 13.11.
Merge requests have a source and a target project that are the same, unless
forking is involved. Creating a fork of the project can cause either of these
scenarios when you create a new merge request:
-
You target an upstream project (the project you forked, and the default
option).
-
You target your own fork.
To have merge requests from a fork by default target your own fork
(instead of the upstream project), you can change the default.
1.
On the left sidebar, select
**Search or go to**
and find your project.
1.
Select
**Settings > Merge requests**
.
1.
In the
**Target project**
section, select the option you want to use for
your default target project.
1.
Select
**Save changes**
.
## Troubleshooting
## Troubleshooting
...
@@ -249,3 +257,14 @@ To make this button appear, one possible workaround is to
...
@@ -249,3 +257,14 @@ To make this button appear, one possible workaround is to
[
remove your project's fork relationship
](
../repository/forking_workflow.md#unlink-a-fork
)
.
[
remove your project's fork relationship
](
../repository/forking_workflow.md#unlink-a-fork
)
.
After removal, the fork relationship cannot be restored. This project can no longer
After removal, the fork relationship cannot be restored. This project can no longer
be able to receive or send merge requests to the source project, or other forks.
be able to receive or send merge requests to the source project, or other forks.
### Email message could not be processed
When sending an email to create a merge request, and you attempt to target an
upstream project, GitLab responds with this error:
```
plaintext
Unfortunately, your email message to GitLab could not be processed.
You are not allowed to perform this action. If you believe this is in error, contact a staff member.
```
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录