Push review mode simplifies the git push workflow by automatically creating and managing Merge Requests without extra tools, enhancing both code quality and collaboration.
Automated code review
In Codeup, the AGit-Flow mode allows you to create a code review from the command line by running git pr, which makes creating reviews more efficient. However, this mode requires you to install the git-repo tool locally and run specific commands. Many developers also want a workflow where submitted code is reviewed before being pushed to the target branch. Push review mode achieves this by automatically creating a Merge Request for your commits when you run git push, requiring no extra tools.
Push review mode advantages
Push review mode is a new code collaboration method in Codeup that offers an efficient code review experience:
For developers: You no longer need to create a new branch or switch to a web browser to start a code review. Simply run
git pushto create a Merge Request in one step.For administrators: You can configure a repository so that when developers
pushcode, the branch is not updated directly. Instead, a Merge Request is automatically created. This ensures code quality through a mandatory review process.
The following table compares push review mode with the standard branch development mode.
Branch development mode | Push review mode | |
Commit code | Commit to a feature branch. | Commit directly to the master branch. |
Start a code review | Use the Codeup web UI. | Run |
Update a code review | Update the feature branch. | Run |
Permissions needed to contribute | Developer or higher | Viewer or higher |
Code quality | Only pushes to a protected branch are reviewed. | All pushes to any branch are reviewed. |
After you enable push review mode in your repository settings, it offers the following benefits:
You can contribute code and create a Merge Request without creating a new branch. You can commit changes directly on the master branch, which avoids the overhead of managing redundant branches.
Running
git pushcreates or updates a Merge Request instead of directly pushing changes to the branch.If your code requires changes after a review, you can make more commits and run
git pushagain to automatically update the existing Merge Request.Users with only Viewer permissions can contribute code. Because pushes create Merge Requests instead of merging code directly, you can grant write permissions to a few administrators while most developers only need read permissions. This model reduces the risk of accidental changes to the repository.
You can use a
push optionto control the behavior of git push. For more information, see the Collaboration with push review mode section.
Enable push review mode
In , click the switch to enable or disable push review mode.

Enabling push review mode changes the behavior of git push. Please be aware of and understand this change before you enable the mode:
Once enabled, running
git pushautomatically creates or updates a Merge Request instead of directly updating the remote branch. This applies even if you have Developer permissions for the repository.A user with the Viewer role can run
git pushto create a Merge Request. The code is merged into the branch only after it is approved and merged according to the branch's requirements.Because
git pushcreates a Merge Request instead of updating code directly, it does not trigger webhooks for push events.You can still use the Codeup web UI to create, edit, or delete files as part of a review workflow.
Collaboration with push review mode
The following examples show how to use push review mode for development collaboration.
Automatic Merge Request creation
Suppose you have a new development task. With push review mode, the workflow has only two steps:
Develop on the master branch.
Run
git push.
Let's walk through an example.
Develop on the
masterbranch of the example repository and create a commit, for example,27e76f58.$ git log commit 27e76f582ca7207a695dd8762b66ef443adcc572 (HEAD -> master) Author: Codeup User <codeup.user@example.com> Date: Tue Oct 11 10:16:18 2022 +0800 feat: new feature Signed-off-by: Codeup User <codeup.user@example.com> commit 44094ec92eb122deab5a0367552bd081540c4353 (origin/master, origin/HEAD) Author: Codeup User <codeup.user@example.com> Date: Tue Oct 11 10:09:39 2022 +0800 Initial commitThen, push the changes to the remote repository by running
git push:$ git push Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 310 bytes | 310.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: +-----------------------------------------------------------------------------------+ remote: | The following tips are provided by Codeup: | remote: +-----------------------------------------------------------------------------------+ remote: | Merge request #31620 has been created, please visit: | remote: | https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31620 | remote: +-----------------------------------------------------------------------------------+ To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git * [new reference] master -> refs/merge-requests/31620/head
As you can see, with push review mode enabled, git push did not directly update the remote branch. Instead, it created Merge Request #31620. The source of this Merge Request is your latest local commit, and the target is the current branch. You can verify this on the Merge Request details page:

This workflow eliminates the need to create a feature branch or use a web browser to create a Merge Request, which greatly simplifies the process. Furthermore, because all pushes must be reviewed before merging, it ensures code quality.
Automatic Merge Request updates
During a code review, you often need to modify your code multiple times based on reviewer feedback. To update the corresponding Merge Request, you can simply run git push again. Let's look at an example.
First, building on commit 27e76f58, make changes based on review comments and create a new commit, e00db452.
$ git log
commit e00db4522f2d6ca5b42377ca76c7b3a7e12db8a5 (HEAD -> master)
Author: Codeup User <codeup.user@example.com>
Date: Tue Oct 11 11:09:42 2022 +0800
feat: fix comment
Signed-off-by: Codeup User <codeup.user@example.com>
commit 27e76f582ca7207a695dd8762b66ef443adcc572
Author: Codeup User <codeup.user@example.com>
Date: Tue Oct 11 10:16:18 2022 +0800
feat: new feature
Signed-off-by: Codeup User <codeup.user@example.com>
commit 44094ec92eb122deab5a0367552bd081540c4353 (origin/master, origin/HEAD)
Author: Codeup User <codeup.user@example.com>
Date: Tue Oct 11 10:09:39 2022 +0800
Initial commitThen, run git push. The system automatically updates the Merge Request and displays a confirmation message.
$ git push
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 340 bytes | 340.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: +-----------------------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +-----------------------------------------------------------------------------------+
remote: | Merge request #31620 has been updated, please visit: |
remote: | https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31620 |
remote: +-----------------------------------------------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
27e76f582c..e00db4522f master -> refs/merge-requests/31620/headThe output shows that this push updated Merge Request #31620. If you check the details page, the source version of the Merge Request has changed to e00db4522, and the commit history now shows two commits. If more changes are needed, repeat this process.
Create a new Merge Request
Running the git push command repeatedly automatically updates an existing Merge Request. If you want to create a new Merge Request instead of updating an existing one, you can add a push option to the command. Run git push -o review=new to create a new Merge Request.
After making local changes, run git push -o review=new. A new Merge Request with ID #31626 is created.
$ git push -o review=new
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 361 bytes | 361.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: +-----------------------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +-----------------------------------------------------------------------------------+
remote: | Merge request #31626 has been created, please visit: |
remote: | https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31626 |
remote: +-----------------------------------------------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
* [new reference] master -> refs/merge-requests/31626/headNote: You cannot create a new Merge Request if an identical one is already open.
$ git push -o review=new
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: +-----------------------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +-----------------------------------------------------------------------------------+
remote: | Merge request create failed. There exists a same merge request in progress: |
remote: | https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31620 |
remote: +-----------------------------------------------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
! [remote rejected] master -> master (create MR failed)
error: failed to push some refs to 'https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git'Update a specific Merge Request
If you have multiple open Merge Requests for the same target branch, running git push will fail because the system cannot determine which one to update.
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 294 bytes | 294.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: +-------------------------------------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +-------------------------------------------------------------------------------------------------+
remote: | You need to manually specify the merge request to update because there are already |
remote: | multiple merge requests that you created earlier for the same target branch: |
remote: | |
remote: | * [ID: 31626] https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31626 |
remote: | * [ID: 31620] https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31620 |
remote: | |
remote: | Then, update specific merge request based on it's ID (MR-ID): |
remote: | git push -o review=<MR-ID> |
remote: | |
remote: | Or you can create a new one: |
remote: | git push -o review=new |
remote: +-------------------------------------------------------------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
! [remote rejected] master -> master (unable to determine which mr to update)
error: failed to push some refs to 'https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git'The output shows two open Merge Requests for the same target branch, with IDs 31626 and 31620. The system cannot determine which one you intend to update. You have two options:
Use
-o review=newto create a new Merge Request.Use
-o review=<MR-ID>to specify the ID of the Merge Request you want to update.
The first option was shown in the Create a new Merge Request section. Let's look at how to update a specific Merge Request.
To update Merge Request #31626, run the command: git push -o review=31626.
$ git push -o review=31626
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 303 bytes | 303.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: +-----------------------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +-----------------------------------------------------------------------------------+
remote: | Merge request #31626 has been updated, please visit: |
remote: | https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31626 |
remote: +-----------------------------------------------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
0ba010f2ff..037578c634 master -> refs/merge-requests/31626/headThis updates the Merge Request with ID 31626.
Resolve update conflicts
When you try to update a Merge Request, you might find that another user has already updated it. To prevent your push from overwriting their changes, the update will fail. For example, if you try to update Merge Request #31644 by running git push -o review=31644, you might see the following error:
$ git push -o review=31644
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 326 bytes | 326.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: +--------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +--------------------------------------------+
remote: | MR is diverged with this push |
remote: +--------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
! [remote rejected] master -> master (MR is diverged with this push)
error: failed to push some refs to 'https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git'The error message indicates that your push has diverged from the remote Merge Request. You have two options:
Pull the other user's changes, resolve the conflicts locally, and then push again.
Force-update the Merge Request with your local changes.
Let's explore the first option: pulling remote changes and resolving conflicts locally.
First, run git fetch origin refs/merge-requests/<mr-id>/head. In this example, the mr-id is 31644, so the command is: git fetch origin refs/merge-requests/31644/head
$ git fetch origin refs/merge-requests/31644/head
From https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo
* branch refs/merge-requests/31644/head -> FETCH_HEADNext, rebase your local changes on top of the fetched reference by running git rebase FETCH_HEAD. This operation may result in conflicts. If it does, resolve them as you normally would.
$ git rebase FETCH_HEAD
Successfully rebased and updated refs/heads/master.After a successful rebase, your local branch contains the remote changes. Now, you can push again.
$ git push -o review=31644
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 331 bytes | 331.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
remote: +-----------------------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +-----------------------------------------------------------------------------------+
remote: | Merge request #31644 has been updated, please visit: |
remote: | https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31644 |
remote: +-----------------------------------------------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
a4a2cad45c..8da076fb44 master -> refs/merge-requests/31644/headYou have now successfully updated Merge Request #31644.
Force-update a Merge Request
Sometimes, you may want to overwrite remote changes in a Merge Request with your local version. To do this, you need to perform a force-update.
You will need two pieces of information:
The Merge Request ID. This is the number at the end of the Merge Request URL. For example, if the URL is
https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31644, the ID is31644.The current source version of the Merge Request. You can find this on the Merge Request details page. In this example, the source version is
8da076fb.
Then, run the command git push -o review=<mr-id> -o old-oid=<old-oid>. For this example, the command is git push -o review=31644 -o old-oid=8da076fb.
This command force-updates Merge Request #31644 to match your local version. Be careful: this action overwrites the changes made by other users. Use this command only when you are certain you want to discard the remote changes to avoid overwriting their work.
$ git push -o review=31644 -o old-oid=8da076fb
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: +-----------------------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +-----------------------------------------------------------------------------------+
remote: | Merge request #31644 has been updated, please visit: |
remote: | https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo/merge_request/31644 |
remote: +-----------------------------------------------------------------------------------+
To https://codeup.aliyun.com/61234c2d1bd96aa110f27b9c/demo.git
8da076fb44..8da076fb44 master -> refs/merge-requests/31644/headBypass review and push directly
If you have made a minor change, such as fixing a typo in a comment, and want to skip the code review process, you can use the git push -o review=no command. This command behaves the same as a standard git push when push review mode is disabled. Note that you must have direct push permissions for the target branch to use the review=no option.
Usage notes
To update a Merge Request, you must be its author or a reviewer. Otherwise, the update will fail.
remote: +---------------------------------------------------------------------+
remote: | The following tips are provided by Codeup: |
remote: +---------------------------------------------------------------------+
remote: | Merge request #31644 update failed. |
remote: | You need to be the author or reviewer to update this merge request. |
remote: +---------------------------------------------------------------------+