Base-branch reviews are useful before opening a pull request or merging a feature branch because they check the full change set that would land on the target branch. That keeps the review centered on the branch-level diff instead of on one commit or only the uncommitted working tree.
The codex review command supports this workflow with --base <branch>, which reviews the changes between the checked-out branch and the named base branch. In a repository that uses main as the merge target, running codex review --base main from a feature branch asks Codex to assess what that branch would introduce relative to main.
The base branch reference must exist locally, and it should be up to date if you want the review to reflect the latest merge target. Review findings are heuristic rather than authoritative, and depending on your Codex configuration, diff context may be sent to a remote backend for analysis, so remove secrets before running the command.
Steps to review changes against a base branch with Codex:
- Open a terminal in the root of the Git repository that contains the branch you want to review.
$ cd ~/src/example-app
- Print the current branch so you know which branch Codex will compare against the base branch.
$ git branch --show-current feature/retry-delay
- Confirm the base branch exists locally before running the review.
$ git branch --list main main
Replace main with the actual merge target in your repository, such as master or a release branch, and update that branch first if it is stale.
- Review the diff summary against the base branch to confirm the scope that Codex will inspect.
$ git diff --stat main...HEAD app.py | 4 ++++ 1 file changed, 4 insertions(+)
- Run the Codex review against the base branch.
$ codex review --base main The patch only adds a small standalone helper and does not introduce any clearly incorrect behavior based on the current codebase and diff. I did not find a discrete, actionable bug that is provably introduced by this change.
Add a short prompt after the command when you want the review to focus on a specific risk, such as backward compatibility or performance.
- Save the review output to a file when you need to share it or keep it with the branch work.
$ codex review --base main > codex-base-review.txt
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
