Skip to main content

Command Palette

Search for a command to run...

Origin

Pull request commands

Every origin pr subcommand with its options. For the rest of the CLI, see Commands. For how pull requests work in Origin, see Pull requests.

Targeting a pull request

Pull request commands infer the repository from ORIGIN_REPO, then the origin git remote in your current checkout. Override it with -R, --repo in org/name format.

Most subcommands take an optional [target]: a number (13 or #13), an Origin pull request URL, or a branch name. Omit it and the CLI uses the open or draft pull request for your current branch:

origin pr view 13        # pull request 13origin pr view my-branch # pull request for my-branchorigin pr view           # pull request for the current branch

Subcommands

SubcommandDescriptionUsage
create | newOpen a pull request against an Origin repoorigin pr create -t "Fix CI"
list | lsList pull requests in a repositoryorigin pr list
statusShow the pull requests relevant to you in a repositoryorigin pr status
view [target]Display a pull request, and optionally its diff, checks, comments, or agentsorigin pr view 13
diff [target]View the diff for a pull requestorigin pr diff
checks [target]Show CI status for a pull requestorigin pr checks
requirements [target]Show what a pull request still needs before it can mergeorigin pr requirements
watch [target]Wait until CI settles, the pull request merges, its head moves, or a comment matchesorigin pr watch
checkout [target]Fetch and check out the pull request branchorigin pr checkout 13
edit [target]Edit the title, body, base branch, labels, or reviewersorigin pr edit -t "New title"
ready [target]Mark a draft as ready for revieworigin pr ready
reviewerList, request, and remove requested reviewersorigin pr reviewer list
review [target]Add a revieworigin pr review --approve
comment [target]Add, edit, or delete a discussion commentorigin pr comment -b "LGTM"
threadList, view, resolve, reopen, and reply to review threadsorigin pr thread list
merge [target]Merge a pull request, or a stack up to and including itorigin pr merge
close [target]Close a pull requestorigin pr close
reopen [target]Reopen a closed pull requestorigin pr reopen
refresh [target]Snapshot a new version from the current refsorigin pr refresh

Pushing to the head branch snapshots a new version on its own. Run origin pr refresh only when origin pr view or origin pr checks still report the previous head commit. It does nothing when the resolved commits already match the latest version.

origin pr review files a formal review. origin pr comment adds a discussion comment. origin pr view --comments lists both.

Create

OptionDescription
-t, --title <title>Title of the pull request
-b, --body <body>Body of the pull request
--description <text>Description of the pull request
-F, --body-file <path>Read the body from a file. Use - for stdin
-H, --head <branch>Branch that holds your commits (default: current branch)
-B, --base <branch>Branch you want your code merged into (default: the --stack-on parent's head branch, else the repo default branch)
--stack-on <target>Stack the new pull request on an existing one, by number or branch
-l, --label <name>Add a label by name. Repeatable or comma-separated
-r, --reviewer <reviewer>Request a review by email, org/team slug, or ID as origin pr reviewer list prints it. Repeatable or comma-separated
--pushPush the head branch without prompting when it isn't on the remote yet
--remote <remote>Remote to push to when the head branch isn't on the remote (default: origin)
--status <status>Initial status: draft or open (default: open)
-d, --draftCreate as a draft. Alias for --status draft
-f, --fillUse commit information for the title and body
--fill-firstUse the first commit's information for the title and body

A new pull request opens ready for review. When the author's Never open PRs as drafts setting is on, Origin opens it ready even with --draft, and the output says so.

--stack-on works best when you branch from the parent's head, so its commits are in your branch. Origin doesn't rebase your branch when the parent moves; run origin stack restack. See Stack commands.

List and status

CommandOptionDescription
list-s, --state <state>Filter by state: open, closed, merged, draft, or all (default: open)
list--mineOnly show pull requests you authored
list-B, --base <branch>Filter by base branch
list-H, --head <branch>Filter by head branch
list--file <path>Filter by a changed path. Repeatable; a trailing / matches a folder prefix
list--commit <sha>Find the pull requests for one full commit SHA: the branch tip, a pushed version, or a merge commit. Can't be combined with the other filters or --limit
list-L, --limit <number>Maximum number of items to fetch (default: 30)
list--json <fields>Output JSON with the fields you list, for example number,title,status
status-c, --conflict-statusShow the merge conflict status of each pull request

View, diff, and checks

CommandOptionDescription
view--diffShow the collected patch diff for the selected version
view--checksInclude the mergeability and CI summary
view-c, --commentsShow comments and reviews, with per-thread resolution state
view--agentsShow the cloud agents attached to the pull request
view--name-onlyWith --diff, print only the changed file paths
view--exclude <glob>Exclude paths matching a glob. Repeatable
view-w, --webOpen the pull request in your browser
view--change-version <number>Version to display (default: latest)
view--json <fields>Output JSON with the fields you list. Bare --json lists the fields
diff--patchDisplay the diff in patch format
diff--name-onlyPrint only the changed file paths
diff-e, --exclude <glob>Exclude files matching a glob. Repeatable
diff--change-version <number>Version to diff (default: latest)
checks--watchWatch the checks until they finish
checks--name <name>Only checks with a matching name, exact or a glob with * and ?. Repeatable
checks--log <job>Print the full log of a finished Origin CI job, named as in the checks list
checks--json <fields>Output JSON with the fields you list

list, status, view, diff, checks, requirements, and watch also take --color <always|never|auto> (default: auto).

To limit origin pr diff to some paths, list them after --. Each is a file, a directory, or a glob relative to the repository root:

origin pr diff 123 -- src/ '*.md'

origin pr checks exits 0 when every check passed, 1 when a check failed or there are no checks, and 8 while checks are pending. --watch polls every 10 seconds until the checks finish.

--diff, --checks, --comments, and --agents only shape the plain-text output of origin pr view. For JSON, request the fields you want instead, such as files, mergeability, ciState, comments, threads, or agents.

Requirements and watch

origin pr requirements names what a pull request still needs before it can merge: required gates and their status at the head commit, approvals, each owner rule and where it stands, the Code Review Gate, and blockers in its stack. --json <fields> takes headSha, mergeability, gates, codeReviewGates, approvals, and ownerRules.

origin pr watch follows a pull request over a live stream and exits when a condition is met:

OptionDescription
--until <condition>checks (default), merged, head:<sha>, or comment:<regex>. comment: also matches comments posted before the watch started
--timeout <seconds>Give up after this many seconds
-f, --followKeep streaming until you press Ctrl-C instead of exiting when CI settles or the pull request merges or closes
--json <fields>Print one object describing how the watch ended: outcome, exitCode, status, headSha, checks, comment

With the default --until checks, origin pr watch exits 0 when the checks pass or the pull request merges, and 1 when a check fails or it closes. Other conditions exit 0 when met and 1 otherwise, for example on a timeout or when the pull request closes first.

Checkout, edit, and lifecycle

CommandOptionDescription
checkout-b, --branch <name>Local branch name to use (default: the pull request's head ref)
checkout--detachCheck out with a detached HEAD
checkout-f, --forceReset the existing local branch to the latest state
checkout--remote <remote>Remote to fetch from (default: origin)
checkout--stackFetch and fast-forward every branch in the pull request's stack, then check out this one. Never merges or rebases locally. Same as origin stack get
edit-t, --title <title>Set a new title
edit-b, --body <body>Set a new body
edit-F, --body-file <path>Read the new body from a file. Use - for stdin
edit-B, --base <branch>Change the base branch
edit--stack-on <target>Stack this pull request on another one, by number or branch
edit--clear-stackRemove this pull request's stack parent. Don't use it after a parent merges, because it splits the stack
edit--add-label <name>Add a label by name. Repeatable
edit--remove-label <name>Remove a label by name. Repeatable
edit--add-reviewer <reviewer>Request a review from a user by email or a team by org/team slug. Repeatable or comma-separated
ready--undoConvert the pull request back to a draft
close-c, --comment <body>Leave a closing comment
reopen-c, --comment <body>Add a reopening comment
reopen--reset-baseReset the base branch to before this pull request's commits when they're already on it, then reopen
reopen-y, --yesSkip the --reset-base confirmation

Labels must already exist on the repository. List them with origin label list.

Merge

OptionDescription
-s, --squashSquash the commits into one commit on the base branch. The default when the repository disallows merge commits
-m, --mergeCreate a merge commit. The default when the repository allows merge commits
-t, --subject <text>Subject of the merge commit, used verbatim. Single pull request merges only
-b, --body <text>Body of the merge commit, used verbatim. Single pull request merges only
-F, --body-file <path>Read the merge commit body from a file. Use - for stdin
--autoMerge once the requirements are met, then return. Turns on merge-when-ready
--disable-autoTurn off merge-when-ready for this pull request
--downstackWith --auto, also turn on merge-when-ready for every open pull request below this one in its stack
--expect-head <number>=<sha>Refuse the merge unless pull request <number> is still at <sha>. Repeatable, and covers every stack member the merge lands
--match-head-commit <sha>Refuse the merge unless this pull request's head is still <sha>. The gh spelling of --expect-head for the target
--base-okMerge even when the base is the head branch of another pull request: an open one the two aren't stacked on, or one closed without merging
--bypass-rulesMerge even when rules on the base branch fail, through your ruleset bypass. Never gets you past a rule you can't bypass

Without --auto, the merge happens now. origin pr view, origin pr status, and origin pr requirements print a Merge-when-ready: line for an open or draft pull request.

On a stacked pull request, merging #N lands every open pull request from the stack root through #N together, in one commit. Origin checks every member first and lands nothing if any member is blocked. To land them one at a time, merge the lowest open pull request each time, then run origin stack sync and origin stack push --all to move the rest onto trunk. --auto arms one pull request, and Origin lands it once it's the lowest open member of its stack. --auto --downstack also arms every open pull request below it. See Stack commands.

Where the repository requires it, a merge that would rely on your ruleset bypass is refused until you pass --bypass-rules.

Reviewers, reviews, and comments

SubcommandDescriptionUsage
reviewer list [target]List the reviewers requested on a pull requestorigin pr reviewer list
reviewer request [target]Request reviews from users, teams, or service accounts. Re-requests existing reviewersorigin pr reviewer request -r dana@acme.com
reviewer remove [target]Remove requested reviewersorigin pr reviewer remove -r acme/platform
comment edit <comment-id>Replace the body of a comment you wroteorigin pr comment edit <comment-id> -b "Fixed"
comment delete <comment-id>Delete a commentorigin pr comment delete <comment-id>

reviewer request and reviewer remove take -r, --reviewer (required): an email, an org/team slug, or an ID as origin pr reviewer list prints it (user_…, grp_…, sa_…). It's repeatable or comma-separated. Comment IDs come from origin pr comment, origin pr view --comments, or origin pr thread list -c.

CommandOptionDescription
review-a, --approveApprove the pull request
review-r, --request-changesRequest changes
review-c, --commentFile the review as a comment
review-b, --body <body>Review body text
review-F, --body-file <path>Read the review body from a file. Use - for stdin
review--change-version <number>Version being reviewed (default: latest)
comment-b, --body <body>Comment body text
comment-F, --body-file <path>Read the comment body from a file. Use - for stdin
comment--edit-lastEdit your newest discussion comment
comment--create-if-noneWith --edit-last, add a comment when you have none
comment--delete-lastDelete your newest discussion comment
comment-y, --yesWith --delete-last, skip the confirmation prompt
comment edit-b, --body, -F, --body-fileNew comment body
comment delete-y, --yesSkip the confirmation prompt

reviewer list takes --json <fields>: kind, id, name, slug, and requestedAt.

Review threads

Every review comment belongs to a thread with its own resolution state. Thread IDs start with cth_.

SubcommandDescriptionUsage
thread list [target]List threads and their resolution stateorigin pr thread list --unresolved
thread view <thread-id> [target]Show one thread with every commentorigin pr thread view cth_123
thread resolve <thread-id> [target]Resolve a threadorigin pr thread resolve cth_123
thread reopen <thread-id> [target]Reopen a resolved threadorigin pr thread reopen cth_123
thread reply <thread-id> [target]Add a comment to a threadorigin pr thread reply cth_123 -b "Fixed"
CommandOptionDescription
list--unresolvedOnly show unresolved threads
list-c, --commentsPrint every comment body instead of the opening excerpt
list--change-version <number>Only threads filed against this version (default: every version)
list, view--json <fields>Output JSON with the fields you list, for example id,resolved,path
reply-b, --body <body>Reply body text
reply-F, --body-file <path>Read the reply body from a file. Use - for stdin

Scripts that gate on "all threads resolved" can use origin pr thread list --unresolved --json id | jq length.

Getting help

Every subcommand takes --help:

origin pr --helporigin pr create --helporigin pr thread --help

Next steps