Skip to content
352 linesCodeBlameRaw
1---
2title: Pull requests and checks
3description: What the merge box shows before a pull request can merge, the checks your workflows report and which ones a merge needs, drafts, closing and reopening, editing and deleting comments, and conflicts found before anyone tries to merge.
4---
5
6At the foot of an open pull request's conversation, the **merge box** says
7what stands between it and its target branch: its checks, its reviews,
8whether it merges cleanly, and the button that merges it. Everything in it
9updates by itself while something is still running.
10
11A pull request g1t made shows **g1t** as its author and **requested by**
12the person who asked for it. That person can manage it as its author could,
13and cannot approve it; see
14[who a pull request is for](/guides/working-with-g1t/#who-a-pull-request-is-for).
15
16## Checks
17
18A pull request's checks are the statuses reported on its head commit. Most
19come from the repository's [workflows](/guides/actions/): every workflow
20that runs on `pull_request` runs on every pull request's head, whoever
21opened it, a person or an agent, and reports a check named after the
22workflow. A workflow named `CI` reports the check `CI`; its status context
23is `CI / pull_request`, the workflow's name and the event it ran for. Other
24parts of g1t report under their own names, such as `g1t / deploy` (or
25`g1t / deploy (<project>)`) for a [deployment](/guides/deployments/), and
26your own CI and integrations report statuses and check runs through the
27API: see [Checks](/guides/checks/).
28
29Which checks a merge needs is up to the repository: its
30[required status checks](#required-status-checks). The merge box lists
31those first:
32
33```text
34Required checks: 1 of 2 passing
35 CI failing Details
36 Lint passing Details
37```
38
39Each required check is **passing**, **failing**, **running**, or
40**expected**, "waiting for status to be reported", when nothing has
41reported it on the head commit yet. **Details** opens the run that
42reported it. Below them are all the other checks, workflow runs job by job,
43each with its state and how long it took. A check that is not required is
44shown, but never holds a merge.
45
46A workflow job's **Details** opens its log on the run's page, where every
47step's output is kept.
48
49A closed or merged pull request keeps a checks section in its conversation:
50its head commit's workflow runs, job by job, as they ended, each with
51**Details** to its log. It is there to read; nothing in it can be re-run,
52and it says nothing about merging.
53
54### Other attempts at the same issue
55
56When an issue has more than one pull request, for example because two
57agents each tried it, every one of them shows **Other attempts at #N**: the
58pull requests for that issue side by side, this one first. Each row has its
59state (open, merged, or closed because another was merged instead), its
60head commit's checks, where its review stands, its size, and the files it
61changes that this one changes too. Pull requests for the same issue are
62alternatives, so they are not listed under **Other work is changing the
63same files**; that box is for work on other issues, which will collide.
64
65### Running them again
66
67People with the Write [role](/guides/access-and-roles/) or higher can press
68**Re-run failed jobs** on a workflow run that failed, to run its failed jobs
69again on the same commit. Every push to the pull request runs its workflows
70again on the new head.
71
72### A repository with no checks
73
74When a repository has no workflows, the merge box says **This repository
75has no checks**: nothing proves a change works, for people or for agents.
76**Add CI** writes a starter workflow for you; see
77[add CI](/guides/actions/#add-ci). The same offer is on the
78**Branches and merging** settings page and the **Actions** page.
79
80## Required status checks
81
82What a pull request needs before it merges is set by the
83[rulesets](/guides/rules/) that cover the branch it merges into, the
84repository's and its workspace's. They hold for every pull request into
85that branch, a person's or an agent's. Someone with the Admin
86[role](/guides/access-and-roles/) sets them under the
87repository's **Settings → Rules**:
88
89| Rule | What it does |
90| --- | --- |
91| Require a pull request before merging | Refuses pushes to the branch, so changes reach it only by merging. Sets the approvals a merge needs, whether an agent's approval counts, whether approvals before the latest push count, and whether [code owners](/guides/codeowners/#require-review-from-code-owners) must approve. |
92| Require status checks to pass | The checks that must pass on a pull request's head before it merges, whether it must be up to date with the branch first, whether someone who may merge can bypass the checks, and optionally only when some paths change. |
93| Require the merge queue | See [merge queue](/guides/merge-queue/). |
94| Require deployments to succeed | A pull request's head must have deployed to these environments. |
95
96[Rules](/guides/rules/#rules) lists every rule, including those for
97agents' changes, confidence, cost, sensitive paths and merge windows.
98The merge box on a pull request lists each rule it does not meet yet, with
99the ruleset it comes from and what to do about it.
100
101### Choosing the checks
102
103**Require status checks to pass** offers the check names reported on the
104repository's commits in the last 30 days. Pick from them, or type a name
105that has not reported yet. A check can be pinned to the integration that
106must report it, such as workflows or deployments.
107
108A required check is met by a status of that name on the pull request's head,
109whatever event reported it:
110
111| What reported it | What the merge does |
112| --- | --- |
113| A status that failed | Refused: "The required check CI failed." |
114| A status still pending | Held: "The required check CI has not finished." |
115| Nothing yet | Held: "The required check CI has not reported on its latest commit." |
116| Success | Allowed |
117
118The same rule holds wherever a pull request merges: the merge button,
119[`merge_pull_request`](/reference/api/pull-requests/merge-pull-request/),
120a g1t agent's [automatic merge](/guides/working-with-g1t/#merging-automatically)
121and the [merge queue](/guides/merge-queue/). Where the rule lets a merger bypass the
122required checks, the merge button has a **bypass** box, and the API takes
123`ignore_checks: true`.
124
125A check that only exists once a workflow has run, such as `CI` from a
126workflow added in a pull request, appears in the list after that workflow
127has run once.
128
129### From the API
130
131```sh
132curl https://api.g1t.sh/repos/<workspace>/<repo>/check-names \
133 -H "Authorization: Bearer $G1T_TOKEN"
134```
135
136[`list_check_names`](/reference/api/repositories/list-check-names/)
137returns the names seen in the last 30 days, most recent first, each as
138`{name, events, last_seen}`. It needs the `repo:read` scope.
139
140```sh
141curl -X PATCH https://api.g1t.sh/repos/<workspace>/<repo>/settings \
142 -H "Authorization: Bearer $G1T_TOKEN" \
143 -H "Content-Type: application/json" \
144 -d '{"required_checks": ["CI", "g1t / deploy"]}'
145```
146
147[`update_repo_settings`](/reference/api/repositories/update-repo-settings/)
148takes `required_checks`, which replaces the whole list, along with
149`required_approvals`, `count_agent_approvals`, `require_up_to_date`,
150`merge_queue`, `allow_ignoring_checks` and `require_code_owner_review`;
151[`get_repo_settings`](/reference/api/repositories/get-repo-settings/)
152returns them. On the MCP server they are the `repository` tool's
153`check_names`, `get_settings` and `update_settings` actions. They read and
154write the "Default branch protection" ruleset; [rulesets](/guides/rules/#from-the-api)
155have routes of their own.
156
157## Reviewers
158
159Ask people to review a pull request in the **Reviewers** box on its page,
160by username. You can also ask a [team](/guides/teams/), as
161`@workspace/team`: everyone in it is asked, or, with the team's
162[review assignment](/guides/teams/#review-assignment) on, g1t picks who,
163and they are listed beside the team. Asking needs the Triage
164[role](/guides/access-and-roles/) or higher, or being the pull request's
165author. Nobody is asked to review their own pull request.
166
167When the repository has a [CODEOWNERS file](/guides/codeowners/), the
168owners of the files a pull request changes are asked by themselves, and
169the pull request shows **Code owners**: who owns which files and whose
170approval is still needed.
171
172Through the API, `POST /repos/{owner}/{name}/pulls/{number}/requested_reviewers`
173takes `reviewers` (usernames) and `team_reviewers` (teams, as
174`workspace/team` or the team's slug), and adds them to whoever is asked
175already; `DELETE` on the same route takes requests away. On
176the MCP server they are the `pull_request` tool's `request_reviewers` and
177`remove_requested_reviewers` actions.
178
179## Drafts, closing and reopening
180
181A draft is still being worked on: it can be reviewed, but it cannot merge
182until it is marked ready for review. Its author, whoever asked g1t for it,
183and anyone with the Triage [role](/guides/access-and-roles/) or higher can
184move a pull request between these states. An
185[archived](/guides/managing-repositories/) repository refuses all of them.
186
187### Convert to a draft
188
189To take a pull request that is ready for review back to a draft, select
190**Convert to draft** under the comment box. It leaves the
191[merge queue](/guides/merge-queue/) if it is in it, and a merge that was
192waiting for it to catch up is called off. Mark it ready again with
193**Mark ready for review**.
194
195Only an open pull request can be converted; a draft, a closed or a merged
196one is refused with `409`.
197
198### Reopen a pull request
199
200To open a closed pull request again, select **Reopen pull request** under
201the comment box. It comes back as it was when it was closed: a draft if it
202was closed as a draft, otherwise ready for review. Its checks and whether
203it merges cleanly are worked out again.
204
205A merged pull request cannot be reopened. Neither can one from a branch of
206the repository whose branch was deleted: push the branch again first.
207
208### From the API
209
210| To | Call | MCP |
211| --- | --- | --- |
212| Convert to a draft | `POST /repos/{owner}/{name}/pulls/{number}/draft` | `pull_request` with `"action": "draft"` |
213| Close | `POST /repos/{owner}/{name}/pulls/{number}/close`, or `PATCH /repos/{owner}/{name}/pulls/{number}` with `"state": "closed"` | `pull_request` with `"action": "close"` |
214| Reopen | `POST /repos/{owner}/{name}/pulls/{number}/reopen`, or `PATCH /repos/{owner}/{name}/pulls/{number}` with `"state": "open"` | `pull_request` with `"action": "reopen"` |
215
216Each answers with the pull request as it is now. Converting publishes
217`pull.converted_to_draft` and reopening publishes `pull.reopened`, with the
218head commit in `commit`; both reach [webhooks](/guides/webhooks/) and can
219start [workflows](/guides/actions/).
220
221## Editing and deleting comments
222
223You can edit and delete your own comments on issues and pull requests.
224Anyone with the Maintain [role](/guides/access-and-roles/) or higher can
225edit and delete anyone's.
226
227- To edit a comment, select **Edit** under it, change the text and select
228 **Save**. The comment shows **edited** beside its time.
229- To delete a comment, select **Delete** under it and confirm. It is
230 removed for everyone and cannot be brought back.
231
232A review that approved or requested changes can be edited but not deleted,
233so its verdict stays on record. The notes in the timeline of what happened,
234such as "closed this", cannot be edited or deleted.
235
236Through the API, `PATCH /repos/{owner}/{name}/issues/comments/{comment_id}`
237with `body` edits a comment and answers with it, and
238`DELETE /repos/{owner}/{name}/issues/comments/{comment_id}` deletes it and
239answers `204`. Both work for comments on issues and on pull requests; each
240comment's `id` is in `GET /repos/{owner}/{name}/issues/{number}` and
241`GET /repos/{owner}/{name}/pulls/{number}`. On the MCP server they are the
242`issue` tool's `edit_comment` and `delete_comment` actions. Editing
243publishes `comment.edited`, with what the comment said before in
244`changes.body.from`; deleting publishes `comment.deleted`, with the comment
245as it was in `comment`.
246
247## Conflicts
248
249g1t works out whether a pull request merges cleanly into its target before
250anyone tries to merge it, and again whenever either side moves: a push to
251the pull request, or anything landing on the target branch.
252
2531. **Without a sandbox.** g1t compares the files the pull request changed
254 since it and the target last agreed with the files the target changed
255 since then. If they share none, the merge cannot conflict, and that is
256 the answer.
2572. **With a short probe.** If they share files, a sandbox merges the two
258 commits without an agent and pushes nothing, and reports the files that
259 conflict. Meanwhile the box says **Checking whether this merges cleanly**,
260 and the merge button waits. Probes are metered as sandbox time; each
261 pair of commits is probed once, and a repository runs at most
262 three at a time, the rest following in turn.
263
264A pull request that conflicts shows **This branch has conflicts that must
265be resolved**, the conflicting files, each linked to its diff, and three
266ways to resolve them:
267
268- **Resolve with g1t.** g1t merges the target branch in,
269 resolves the conflicts keeping what both sides meant, and pushes the
270 result. It is told which files conflict. Available to whoever can push to
271 the pull request: for a pull request's fork, whoever opened it (whoever
272 asked g1t for one it made); for a branch, anyone with the Write role or
273 higher.
274- **Resolve in the browser.** Coming soon.
275- **On the command line.** The box lists the commands, each with a copy
276 button. For a pull request from a branch:
277
278 ```sh
279 git fetch origin
280 git checkout my-branch
281 git merge origin/main
282 # fix each conflicting file, then
283 git add -A && git commit --no-edit
284 git push origin my-branch
285 ```
286
287 For a pull request in its own fork, clone the fork and pull `main` into
288 it instead:
289
290 ```sh
291 git clone https://g1t.sh/pulls/<id>.git && cd <id>
292 git pull --no-rebase https://g1t.sh/<owner>/<repo>.git main
293 ```
294
295While it conflicts, it cannot be merged or added to the
296[merge queue](/guides/merge-queue/), and the merge button says so. Once the
297fix is pushed, g1t works it out again.
298
299A pull request that only has fallen behind its target, without conflicts,
300still merges: merging brings it up to date first, unless the repository
301requires pull requests to be up to date.
302
303## Catching up
304
305When the target branch has moved, the merge box says **main has moved since
306this was made**. Whoever can push to the pull request (whoever opened it,
307or asked g1t for it, for one in its own fork; anyone with the Write
308[role](/guides/access-and-roles/) or higher, for a branch) can
309press **Catch up with main now**:
310
3111. **When the two changed different files**, g1t merges `main` in itself,
312 in a few seconds. The merge commit is named **Merge main into
313 *branch***, has the pull request's head and `main`'s head as its
314 parents, and is authored and pushed as you. The box then says **Brought
315 up to date with main**, and the workflows run again on the
316 new commit, as after any push.
3172. **When both changed some of the same files**, a sandbox merges `main` in
318 with git, and [g1t](/guides/working-with-g1t/) resolves any conflict.
319 The box says what is happening (**g1t is resolving conflicts with
320 main** when the merge is known to conflict) with the run's live step and
321 how long it has taken. It usually takes about a minute. When the result
322 is pushed, the box shows the pull request up to date; if the run fails,
323 or nothing has been pushed after five minutes, the box says so and
324 offers **Try again**. Nothing is pushed by a run that fails.
325
326Either way the merge is pushed only if the pull request's branch is still
327where it was when the catch-up started. If someone pushed to it meanwhile,
328the catch-up stops with nothing lost, and you can press it again.
329
330The second case needs g1t's agent enabled for the workspace and is
331[charged](/guides/usage-and-billing/#what-is-charged) as agent work; the
332first is not.
333
334A pull request [g1t](/guides/working-with-g1t/) opened that is found to conflict
335is sent back to resolve it by itself, before it is ready.
336
337## From the API
338
339`GET /repos/{owner}/{name}/pulls/{number}` returns, besides the pull request:
340
341| Field | What it is |
342| --- | --- |
343| `statuses` | What each workflow run, and anything else that reports statuses, said about its head, with a link to the run. |
344| `required_checks` | Each check the default branch requires, as it stands on the head: `name`, `state` (`success`, `failure`, `pending`, or `expected` when nothing has reported it yet), `description` and `target_url`. Empty when none are required. |
345| `checks` | The latest record against its head from g1t itself, such as the merge queue taking it out, with `earlier_checks` before it. |
346| `mergeable` | `clean`, `conflicting`, `checking` or `unknown`. |
347| `conflicts` | When conflicting, the files that conflict. |
348| `behind` | Whether its target has moved on without it. |
349| `reviewers`, `team_reviewers` | The people and the [teams](/guides/teams/#review-requests) asked to review it. |
350| `code_owners` | Who owns the files it changes and whose approval is still needed; see [CODEOWNERS](/guides/codeowners/#through-the-api). Absent when its target has no CODEOWNERS file. |
351
352An agent sees the same through the `pull_request` tool's `get` action.