文档

Unity Version Control

Create and manage merge requests in the desktop application

Create a merge request in the Unity Version Control desktop application, ask for a review, and merge your changes when they're approved.
阅读时间6 分钟最后更新于 15 小时前

Create merge requests in the Unity Version Control (UVCS) desktop application so that your team can review and approve the changes on your branch before you merge them. A merge request tracks your reviewers and their feedback, has a status that runs from draft to merged, and lets you merge directly from the request.

Create a merge request

Create a merge request when the work on your branch is ready for review. By default, the destination branch is the parent of your branch. To merge the same changes into several branches, for example to apply a fix to an older release branch (backport), create one merge request for each destination branch.
To create a merge request:
  1. Do one of the following:
    • In the Branch Explorer, right-click (macOS: Ctrl+click) the branch and select New merge request for this branch.
    • In the Branch Explorer, select the branch. In the Details panel, under Merge request, select New merge request.
    • Select the Merge Requests tab, then select New merge request (+).
    The Create merge request dialog opens.
  2. In the Create merge request dialog, check that Source branch is the branch you want to merge, and that Destination branch is the branch you want to merge into.
  3. In Title, keep the suggested title or enter a new one. The suggested title is the name of the source branch.
  4. In Description, give an overview of the changes or instructions for your reviewers.
  5. In Reviewers, search for and select the users or groups that you want to review your changes. You can also add reviewers after you create the merge request.
  6. Select Create merge request.
UVCS creates the merge request with the Open status and opens it in a new window. The merge request appears in the Needs my review filtered view of each reviewer.
If your work isn't ready for review yet, you can create the merge request as a draft. In the last step, select the arrow next to Create merge request and select Create draft merge request. When your changes are ready, open the merge request for review: in the Overview tab, select Ready for review.

Track your merge requests

Use the Merge Requests tab to find merge requests. The tab has the following views:

View

Description

Merge RequestsDisplays all merge requests in the repository.
Needs my reviewDisplays open merge requests where you're a reviewer and your review status is Under review.
Opened by meDisplays open merge requests that you created.
Each merge request has one of the following statuses:

Status

Description

DraftThe merge request isn't ready for review and can't be merged.
OpenThe merge request is ready for review.
MergedThe source branch is merged into the destination branch.
ClosedSomeone closed the merge request without merging it.
You can filter the list by Status, Review status, Created by, Reviewer, Reviewer's status (only in Needs my review), and Last activity.
When you select a merge request in the list, the Details panel displays its branches, status, description, reviewers, and branch attributes.
To open a merge request, double-click it. The merge request window has two tabs:

Tab

Description

OverviewDisplays the description, merge status, reviewers, branch attributes, and a timeline of all the activity on the merge request.
Review changesDisplays the changesets and diffs of the source branch, and the comments on each line.

Review a merge request

As a reviewer, review the changes, comment on specific lines, and set your review status.
To review the changes in a merge request:
  1. In the Merge Requests tab, select Needs my review.
  2. Double-click a merge request to open it.
  3. Select the Review changes tab.
  4. Select Review changeset by changeset or Review entire branch.
  5. If you review changeset by changeset, select a changeset, then select a file.
  6. To comment on a line, select + next to the line in the diff.
  7. Select the type of comment.
  8. Enter your comment and select Comment.
Each commented line shows a marker for the type of comment:
  • C: Change request
  • Q: Question
  • R: Regular comment

Set your review status

When you finish reviewing, set your review status to tell the author whether the changes are ready to merge.
To set your review status:
  1. Select Mark review.
  2. Select one of the following review statuses:

    Review status

    Description

    Under reviewYou haven't finished your review.
    Rework requiredThe author needs to make changes before merging.
    ReviewedYou approve the changes.
  3. Select Mark as to confirm the status. You can also add a comment for the author.
The Reviewers panel shows the status of each reviewer. The merge status in the Overview tab combines the statuses of all reviewers and shows the most restrictive one.

Resolve change requests

When at least one reviewer requests changes, the merge request shows Changes required and you can't merge it.
To resolve a change request:
  1. In your workspace, make the requested changes on the source branch of the merge request.
  2. Select the Pending Changes tab, then select only the files that resolve the change request.
  3. Select Close change requested in review and select the change request.
  4. Enter the rest of your check-in comment after the
    [apply-change:<ID>]
    text that UVCS adds to the comment.
  5. Select Check in.
In the Review changes tab of the merge request, the Review comments summary panel shows the change request as Done, with a link to the changeset that resolved it.

Request another review

After you resolve the change requests, ask the reviewer to check your changes again.
To request another review:
  1. In the merge request, select the Overview tab.
  2. In the Reviewers panel, select Re-request review next to the reviewer's name.
The reviewer's status changes back to Under review, and the merge request appears in their Needs my review filtered view again.

Merge the changes

You can merge the changes when the merge request is open, at least one reviewer marks it as Reviewed, and no reviewer requires rework. The Overview tab shows the merge status, for example Changes reviewed, and enables Merge this request. If your repository uses a mergebot, the mergebot can merge the merge request automatically. For more information, refer to Mergebots.
To merge the changes:
  1. In the merge request, select the Overview tab.
  2. Select Merge this request.
UVCS merges the source branch into the destination branch in a new changeset, and the merge request status changes to Merged. UVCS also hides the source branch in the Branch Explorer but keeps its history. To show hidden branches, enable Show hidden in the Other filter.

Close a merge request or convert it to a draft

Close a merge request if you no longer want to merge the branch. Convert it to a draft if it needs more work before anyone reviews it.
To close a merge request or convert it to a draft:
  1. In the merge request, select the Overview tab.
  2. Do one of the following:
    • To close the merge request without merging it, select Close merge request.
    • To convert the merge request to a draft, select the arrow next to Close merge request and select Convert to draft.

Additional resources