gt-pr-create1
Create a pull request
Usage
gt pr
create
[flags]
Overview
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 or you cannot push to it, to the only remote of your own fork; otherwise it goes to the repository's remote. Without push access and a fork remote, gt offers on a terminal to fork the repository and adds the fork as the remote "fork", or one named after your login when "fork" points elsewhere; elsewhere, run gt repo fork --add-remote first. A missing base branch fails before the push. After a push to a fork, gt pr commands on the branch keep selecting the repository rather than the fork.
With --agit, only the author of an AGit pull request can push to it, so on a branch of someone else's, such as from gt pr checkout, pass --topic to open your own.
Json fields
assignees, author, base, body, comments, created_at, draft, due_date, head, head_remote_deleted, head_repo, head_sha, id, labels, merge_commit_sha, mergeable, merged, merged_at, merged_by, milestone, number, review_decision, reviewer_teams, reviewers, reviews, state, title, updated_at, url
Options
--agit[=false]
Create the pull request through AGit push (refs/for)
--allow-maintainer-edits[=true]
Allow maintainers to push to the head branch
-a, --assignee=[]
Assign users by username; @me for yourself
--attachment=[]
Attach a file to the pull request (repeatable)
-B, --base=""
Base branch (default: the repository's default branch)
-b, --body=""
Pull request body
-F, --body-file=""
Read the body from file, or - for stdin
--deadline=""
Due date: YYYY-MM-DD, RFC3339 or Unix timestamp; only the date counts, as the end of that day in UTC
-d, --draft[=false]
Create a draft pull request
-e, --editor[=false]
Write the body in your editor, starting from the repository's template
-f, --fill[=false]
Skip the questions and take the title and body from the commits
-H, --head=""
Head branch, or OWNER:BRANCH for a fork (default: the current branch)
-h, --help[=false]
help for create
-l, --label=[]
Apply labels by name; repo: or org: picks between same-named labels
-m, --milestone=""
Milestone title or ID
-p, --project=[]
Add the pull request to the repository's or its owner's project with this ID or title, a number being an ID first (repeatable)
-r, --reviewer=[]
Request reviews from users
--reviewer-team=[]
Request reviews from teams within the repository's organization
-t, --title=""
Pull request title (default: the commit message of a single-commit branch, or the branch name)
--topic=""
AGit topic name (default: head branch); requires --agit
-w, --web[=false]
Open the comparison of --head and --base in the browser to create the pull request there
Options inherited from parent commands
--csv[=""]
Output CSV with the specified comma-separated fields, or all fields
--cwd=""
Working directory for repository discovery
--debug[=false]
Log the method, URL, status, and duration of each HTTP request to stderr
--host=""
Gitea instance URL, including any base path
--interactive[=false]
Allow prompts with machine output
-q, --jq=""
Filter JSON output using a jq expression; implies --json
--json[=""]
Output JSON with the specified comma-separated fields, or all fields
--no-input[=false]
Disable prompts and implicit editor/browser interactions
--remote=""
Git remote used for repository discovery
-R, --repo=""
Select a repository as OWNER/REPO or URL
--sudo=""
Perform API requests as this user (requires an administrator account)
--user=""
Account name on the selected instance
-y, --yes[=false]
Accept confirmations without prompting
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