# tea pr: Create and List Gitea Pull Requests

> tea pr create, list, and merge manage Gitea/Forgejo pull requests. Reference for --head, --base, --title, --login, and the CI errors around them.

Source: https://latchkey.dev/learn/command-reference/tea-pr-ci  
Updated: 2026-06-30

tea pr create opens a pull request on a Gitea or Forgejo instance from the command line.

Once tea login is set up, tea pr is how you open, list, and merge pull requests against a self-hosted Gitea or Forgejo repo inside a pipeline.

## What it does

tea pr groups pull-request operations. create opens a PR from a head branch into a base branch, list shows open PRs, and merge merges one by index using a chosen strategy.

## Common usage

```Terminal
# open a PR from the current branch
tea pr create --repo owner/repo \
  --head feature-x --base main --title "Add feature X"
# list open PRs, merge one non-interactively
tea pr list --repo owner/repo
tea pr merge 42 --repo owner/repo --style squash
```

## Options

| Flag | What it does |
| --- | --- |
| --repo owner/repo | Target repository |
| --head <branch> | Source branch for the PR |
| --base <branch> | Target branch (default the repo default) |
| --title <t> | PR title (avoids the interactive prompt) |
| --description <d> | PR body |
| --login <name> | Which configured login to use |
| --style <s> | Merge style: merge, rebase, squash (with tea pr merge) |

## In CI

Pass --title (and --repo, --head, --base) so create runs without prompts. If you configured multiple tea logins, pass --login to pin the right instance rather than relying on the default.

## Common errors in CI

"Error: Please specify a repo" means --repo was omitted and tea could not infer it from the remote. "422 Unprocessable Entity" on create usually means a PR already exists for that head/base or the head branch was not pushed. "401 Unauthorized" means the login token is invalid. "unknown login" means the --login name is not registered.

## Using this in CI

CI checkouts are shallow and detached by default, which changes the answer this command gives you. Commands that read history, branch names, or tags need the checkout configured for it.

```.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    fetch-depth: 0   # history, tags, and git describe all need this

- run: |
    git rev-parse --is-shallow-repository   # expect false
    git rev-parse --abbrev-ref HEAD          # prints HEAD when detached
```

> `git rev-parse --abbrev-ref HEAD` returns the literal string `HEAD` on a detached checkout rather than a branch name. On GitHub Actions read `github.ref_name` instead; the git command cannot know what it was checked out for.

## FAQ

### tea pr: Create and List Gitea Pull Requests?

Once tea login is set up, tea pr is how you open, list, and merge pull requests against a self-hosted Gitea or Forgejo repo inside a pipeline.

### What it does?

tea pr groups pull-request operations. create opens a PR from a head branch into a base branch, list shows open PRs, and merge merges one by index using a chosen strategy.

### In CI?

Pass --title (and --repo, --head, --base) so create runs without prompts. If you configured multiple tea logins, pass --login to pin the right instance rather than relying on the default.

### Common errors in CI?

"Error: Please specify a repo" means --repo was omitted and tea could not infer it from the remote. "422 Unprocessable Entity" on create usually means a PR already exists for that head/base or the head branch was not pushed. "401 Unauthorized" means the login token is invalid. "unknown login" means the --login name is not registered.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
