Files
docs/cli-docs/reference/pr/create.md
T
bircni 55c3a392a1 feat: generate the gt command reference from gitea/cli
update_cli_docs.sh runs gt's own generator and lays the pages out for the
site: one directory per command group, front matter, titles, sidebar
order, fenced help text and rewritten links. --released succeeds while no
series is documented. A weekly workflow proposes updates like the runner's.

Signed-off-by: bircni <[email protected]>
2026-10-22 11:28:15 +02:00

4.3 KiB

sidebar_position, description
sidebar_position description
7 Create a pull request

gt pr create

Create a pull request

Synopsis

Create a pull request from the current branch, or from --head.

On a terminal without flags, gt asks for the title and body, then what to do next: submit,
submit as a draft, add metadata or change the branches. Any flag of this command, such as
--fill, --head or --base (but not global flags such as --repo), skips the questions: the
title is then --title, else the commit message of a single-commit branch, else the branch
name.

A branch that is not on the remote yet is pushed first, with its upstream set, after a
confirmation; without a terminal, pass --yes to push it. A branch that
does not track a branch of the same name yet goes to the fork when origin is a fork of the
repository, or, when origin is not the repository itself, to the only remote of your own
fork; otherwise it goes to the repository's remote.
gt pr create [flags]

Examples

# Create a pull request for the current branch interactively
$ gt pr create

# Take the title and body from the commits, without questions
$ gt pr create --fill

# In a script, also push the branch without asking
$ gt pr create --fill --yes

$ gt pr create -t "Add login" -b "Closes #1" -B develop -r carol -l enhancement

Options

      --agit                     Create the pull request through AGit push (refs/for)
      --allow-maintainer-edits   Allow maintainers to push to the head branch (default true)
  -a, --assignee strings         Assign users by username; @me for yourself
      --attachment stringArray   Attach a file to the pull request (repeatable)
  -B, --base string              Base branch (default: the repository's default branch)
  -b, --body string              Pull request body
  -F, --body-file file           Read the body from file, or - for stdin
      --deadline date            Due date: YYYY-MM-DD, RFC3339 or Unix timestamp; only the date counts, as the end of that day in UTC
  -d, --draft                    Create a draft pull request
  -e, --editor                   Write the body in your editor, starting from the repository's template
  -f, --fill                     Skip the questions and take the title and body from the commits
  -H, --head string              Head branch, or OWNER:BRANCH for a fork (default: the current branch)
  -h, --help                     help for create
  -l, --label strings            Apply labels by name; repo: or org: picks between same-named labels
  -m, --milestone string         Milestone title or ID
  -p, --project title            Add the pull request to the project with this title, the repository's or its organization's (repeatable)
  -r, --reviewer strings         Request reviews from users; @me for yourself
      --reviewer-team strings    Request reviews from teams within the repository's organization
  -t, --title string             Pull request title (default: the commit message of a single-commit branch, or the branch name)
      --topic string             AGit topic name (default: head branch); requires --agit
  -w, --web                      Open the comparison page in the browser to create the pull request there

Options inherited from parent commands

      --cwd directory       Working directory for repository discovery
      --debug               Log the method, URL, status, and duration of each HTTP request to stderr
      --host URL            Gitea instance URL, including any base path
      --interactive         Allow prompts with machine output
  -q, --jq expression       Filter JSON output using a jq expression; implies --json
      --json fields[="*"]   Output JSON with the specified comma-separated fields, or all fields
      --no-input            Disable prompts and implicit editor/browser interactions
      --remote remote       Git remote used for repository discovery
  -R, --repo OWNER/REPO     Select a repository as OWNER/REPO or URL
      --sudo user           Perform API requests as this user (requires an administrator account)
      --user name           Account name on the selected instance
  -y, --yes                 Accept confirmations without prompting

SEE ALSO

  • gt pr: Manage pull requests