Skip to content

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t.sh
82 linesCodeBlameRaw
1---
2title: Pull requests into other branches
3description: Open a pull request into a branch other than the default one, change the branch a pull request merges into, and what holds there.
4---
5
6A pull request merges into its base: the repository's default branch,
7unless you choose another. A release branch, a long-running feature branch
8or a branch that collects several changes before they reach `main` can
9each take pull requests of their own.
10
11## Open a pull request into another branch
12
131. Open **Pull requests**, then **New pull request**. Or open **Compare**,
14 choose the branch to merge into as **base** and yours as **compare**,
15 then **Open a pull request**.
162. Beside **into**, choose the branch it should merge into.
173. Give it a title and a description, and open it.
18
19A branch can have one open pull request into each base.
20
21## Change the branch it merges into
22
23You need the Write [role](/guides/access-and-roles/) or higher.
24
251. Open the pull request.
262. Under its title, choose the branch name after **into**.
273. Pick the branch it should merge into.
28
29Changing the base is noted in the conversation and is a `pull.base_changed`
30event. Whether it is behind, whether it merges cleanly, and its required
31checks are worked out again against the new base, and a pull request in
32the merge queue leaves it.
33
34## What holds in another branch
35
36A pull request is held to the [rules](/guides/rules/) of the branch it
37merges into: every ruleset, the repository's and its workspace's, whose
38patterns cover that branch. A ruleset that targets `release/*` holds for
39pull requests into `release/1.x` just as one that targets
40`~DEFAULT_BRANCH` holds for those into the default branch.
41
42| | Into the default branch | Into another branch |
43| --- | --- | --- |
44| Required checks, approvals, being up to date | As the rules covering it ask | As the rules covering it ask; nothing when none cover it |
45| [Merge queue](/guides/merge-queue/) | Joins it, when a rule requires it | Never; it merges directly |
46| Catching up | Merges the default branch in | Merges its base in |
47| Its issue | Closes when it merges | Stays open |
48
49Merging still needs the Write role. Under **Settings → Rules**, **What holds
50for a branch** shows every rule that covers a branch.
51
52## g1t's agent and other branches
53
54When you assign an issue to g1t, its pull request merges into the default
55branch. Change the base on its pull request and g1t works against that
56branch from then on: it catches up with it, resolves conflicts with it,
57and its reviewer compares the change with it. `@g1t` on such a pull
58request works against its base too.
59
60## From the API
61
62- `base` on `POST /repos/{owner}/{name}/pulls` (`pull_request` `create`)
63 opens it into that branch. Leave it out for the default branch.
64- `base` on `PATCH /repos/{owner}/{name}/pulls/{number}`
65 (`pull_request` `update`) changes it.
66- `base` filters `GET /repos/{owner}/{name}/pulls` (`pull_request` `list`).
67- A pull request's `base` names the branch it merges into.
68
69```sh
70curl -X PATCH https://api.g1t.sh/repos/acme/web/pulls/14 \
71 -H "Authorization: Bearer $G1T_TOKEN" \
72 -H "Content-Type: application/json" \
73 -d '{"base": "release/1.x"}'
74```
75
76[Workflows](/guides/actions/) see the base as `github.base_ref` and
77`pull_request.base.ref`, and `branches` filters on `pull_request` match it.
78A base change starts `pull_request` workflows with the `edited` activity
79type.
80
81[Dependency updates](/guides/dependency-updates/) open their pull requests
82into an entry's `target-branch`.