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
418 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, or by a [g1t Actions](/guides/actions/) job
110of that name, as on GitHub. A job's check is named as GitHub names it:
111the job's `name:` (or its id), with a matrix combination's values after it
112in brackets, such as `test` or `build (ubuntu-latest, 22)`, and
113`<calling job> / <job>` for a job of a called workflow. A branch rule
114copied from GitHub that requires `test` is met by the `test` job, and one
115that requires the workflow's name, such as `CI`, is met by the whole run.
116Type a job's name to require it: the list offers the names of statuses.
117Each job's latest attempt counts. One that was skipped passes the check,
118and one that was cancelled fails it.
119
120| What reported it | What the merge does |
121| --- | --- |
122| A status that failed | Refused: "The required check CI failed." |
123| A status still pending | Held: "The required check CI has not finished." |
124| Nothing yet | Held: "The required check CI has not reported on its latest commit." |
125| Success | Allowed |
126
127The same rule holds wherever a pull request merges: the merge button,
128[`merge_pull_request`](/reference/api/pull-requests/merge-pull-request/),
129a g1t agent's [automatic merge](/guides/working-with-g1t/#merging-automatically)
130and the [merge queue](/guides/merge-queue/). Where the rule lets a merger bypass the
131required checks, the merge button has a **bypass** box, and the API takes
132`ignore_checks: true`.
133
134A check that only exists once a workflow has run, such as `CI` from a
135workflow added in a pull request, appears in the list after that workflow
136has run once.
137
138### From the API
139
140```sh
141curl https://api.g1t.sh/repos/<workspace>/<repo>/check-names \
142 -H "Authorization: Bearer $G1T_TOKEN"
143```
144
145[`list_check_names`](/reference/api/repositories/list-check-names/)
146returns the names seen in the last 30 days, most recent first, each as
147`{name, events, last_seen}`. It needs the `repo:read` scope.
148
149```sh
150curl -X PATCH https://api.g1t.sh/repos/<workspace>/<repo>/settings \
151 -H "Authorization: Bearer $G1T_TOKEN" \
152 -H "Content-Type: application/json" \
153 -d '{"required_checks": ["CI", "g1t / deploy"]}'
154```
155
156[`update_repo_settings`](/reference/api/repositories/update-repo-settings/)
157takes `required_checks`, which replaces the whole list, along with
158`required_approvals`, `count_agent_approvals`, `require_up_to_date`,
159`merge_queue`, `allow_ignoring_checks` and `require_code_owner_review`;
160[`get_repo_settings`](/reference/api/repositories/get-repo-settings/)
161returns them. On the MCP server they are the `repository` tool's
162`check_names`, `get_settings` and `update_settings` actions. They read and
163write the "Default branch protection" ruleset; [rulesets](/guides/rules/#from-the-api)
164have routes of their own.
165
166## Reviewers
167
168Ask people to review a pull request in the **Reviewers** box on its page,
169by username. You can also ask a [team](/guides/teams/), as
170`@workspace/team`: everyone in it is asked, or, with the team's
171[review assignment](/guides/teams/#review-assignment) on, g1t picks who,
172and they are listed beside the team. Asking needs the Triage
173[role](/guides/access-and-roles/) or higher, or being the pull request's
174author. Nobody is asked to review their own pull request.
175
176When the repository has a [CODEOWNERS file](/guides/codeowners/), the
177owners of the files a pull request changes are asked by themselves, and
178the pull request shows **Code owners**: who owns which files and whose
179approval is still needed.
180
181Through the API, `POST /repos/{owner}/{name}/pulls/{number}/requested_reviewers`
182takes `reviewers` (usernames) and `team_reviewers` (teams, as
183`workspace/team` or the team's slug), and adds them to whoever is asked
184already; `DELETE` on the same route takes requests away. On
185the MCP server they are the `pull_request` tool's `request_reviewers` and
186`remove_requested_reviewers` actions.
187
188## Agent reviews
189
190Your workspace's [agents](/guides/agents/) comment on issues and pull
191requests, and review pull requests, as themselves: a comment from Margo
192shows her pixel face, her name with an **Agent** badge (linked to
193[her page](/guides/agents/#the-agents-page)), and **on behalf of @ana**,
194the person she was working for.
195
196An agent's review is **advisory**. It shows its verdict (approved,
197requested changes, or reviewed, for one that only comments) with an
198**Advisory** chip, and in the summary of reviews at the top of the pull
199request, but it counts toward nothing:
200
201- It never satisfies the approvals a branch requires, nor a
202 [code owner's](/guides/codeowners/) approval. A person still approves.
203- A request for changes from an agent never blocks a merge and never sends
204 g1t back to revise; a person's does.
205- It is never counted as a review on the profile of the person it acted
206 for.
207
208What an agent may do on a pull request is capped by the person it acts
209for: they must be able to read the repository and comment on it, as if
210they wrote it themselves, and an archived repository refuses it. Beyond
211that:
212
213- An agent doesn't review a draft, nor a closed or merged pull request. It
214 can still comment on them.
215- An agent writes at most 5 comments and reviews on one issue or pull
216 request an hour.
217- Mentioning `@g1t` in an agent's comment doesn't put g1t to work, and an
218 agent can't give commands on [dependency updates](/guides/dependency-updates/).
219
220The person it acted for can edit and delete what the agent wrote, as its
221author could, and so can anyone with the Maintain
222[role](/guides/access-and-roles/) or higher. A review stays, as a
223person's does.
224
225People mentioned in an agent's comment, and everyone subscribed to the
226pull request, hear of it in their [notifications](/guides/notifications/) as from
227**Margo (agent)**, with "(advisory)" on a review. It publishes
228`comment.created` as a person's comment does, with `agent` (its `id`,
229`handle`, `display_name` and `avatar_seed`), `acting_for`, and for a
230review `advisory: true` and the verdict, so [webhooks](/guides/webhooks/)
231see it too; its `actor` is the person it acted for. Through the API and
232the MCP server, each such comment has `agent`, `acting_for` and, for a
233review, `advisory: true`; its `author` is the agent, of kind `agent`.
234
235## Drafts, closing and reopening
236
237A draft is still being worked on: it can be reviewed, but it cannot merge
238until it is marked ready for review. Its author, whoever asked g1t for it,
239and anyone with the Triage [role](/guides/access-and-roles/) or higher can
240move a pull request between these states. An
241[archived](/guides/managing-repositories/) repository refuses all of them.
242
243### Open a draft
244
245When you open a pull request from a branch, choose **Open as draft** to
246say it isn't ready yet. Push to the branch as often as you like; select
247**Mark ready for review** when it is. Routines that review pull requests
248(an agent's routine that runs when a pull request is ready for review) run
249then, not before. Through the API, send `"draft": true` when you open it.
250
251### Convert to a draft
252
253To take a pull request that is ready for review back to a draft, select
254**Convert to draft** under the comment box. It leaves the
255[merge queue](/guides/merge-queue/) if it is in it, and a merge that was
256waiting for it to catch up is called off. Mark it ready again with
257**Mark ready for review**.
258
259Only an open pull request can be converted; a draft, a closed or a merged
260one is refused with `409`.
261
262### Reopen a pull request
263
264To open a closed pull request again, select **Reopen pull request** under
265the comment box. It comes back as it was when it was closed: a draft if it
266was closed as a draft, otherwise ready for review. Its checks and whether
267it merges cleanly are worked out again.
268
269A merged pull request cannot be reopened. Neither can one from a branch of
270the repository whose branch was deleted: push the branch again first.
271
272### From the API
273
274| To | Call | MCP |
275| --- | --- | --- |
276| Convert to a draft | `POST /repos/{owner}/{name}/pulls/{number}/draft` | `pull_request` with `"action": "draft"` |
277| Close | `POST /repos/{owner}/{name}/pulls/{number}/close`, or `PATCH /repos/{owner}/{name}/pulls/{number}` with `"state": "closed"` | `pull_request` with `"action": "close"` |
278| Reopen | `POST /repos/{owner}/{name}/pulls/{number}/reopen`, or `PATCH /repos/{owner}/{name}/pulls/{number}` with `"state": "open"` | `pull_request` with `"action": "reopen"` |
279
280Each answers with the pull request as it is now. Converting publishes
281`pull.converted_to_draft` and reopening publishes `pull.reopened`, with the
282head commit in `commit`; both reach [webhooks](/guides/webhooks/) and can
283start [workflows](/guides/actions/).
284
285## Editing and deleting comments
286
287You can edit and delete your own comments on issues and pull requests.
288Anyone with the Maintain [role](/guides/access-and-roles/) or higher can
289edit and delete anyone's.
290
291- To edit a comment, select **Edit** under it, change the text and select
292 **Save**. The comment shows **edited** beside its time.
293- To delete a comment, select **Delete** under it and confirm. It is
294 removed for everyone and cannot be brought back.
295
296A review that approved or requested changes can be edited but not deleted,
297so its verdict stays on record. What an
298[agent wrote as itself](#agent-reviews) is the person it acted for's to
299edit and delete. The notes in the timeline of what happened,
300such as "closed this", cannot be edited or deleted.
301
302Through the API, `PATCH /repos/{owner}/{name}/issues/comments/{comment_id}`
303with `body` edits a comment and answers with it, and
304`DELETE /repos/{owner}/{name}/issues/comments/{comment_id}` deletes it and
305answers `204`. Both work for comments on issues and on pull requests; each
306comment's `id` is in `GET /repos/{owner}/{name}/issues/{number}` and
307`GET /repos/{owner}/{name}/pulls/{number}`. On the MCP server they are the
308`issue` tool's `edit_comment` and `delete_comment` actions. Editing
309publishes `comment.edited`, with what the comment said before in
310`changes.body.from`; deleting publishes `comment.deleted`, with the comment
311as it was in `comment`.
312
313## Conflicts
314
315g1t works out whether a pull request merges cleanly into its target before
316anyone tries to merge it, and again whenever either side moves: a push to
317the pull request, or anything landing on the target branch.
318
3191. **Without a sandbox.** g1t compares the files the pull request changed
320 since it and the target last agreed with the files the target changed
321 since then. If they share none, the merge cannot conflict, and that is
322 the answer.
3232. **With a short probe.** If they share files, a sandbox merges the two
324 commits without an agent and pushes nothing, and reports the files that
325 conflict. Meanwhile the box says **Checking whether this merges cleanly**,
326 and the merge button waits. Probes are metered as sandbox time; each
327 pair of commits is probed once, and a repository runs at most
328 three at a time, the rest following in turn.
329
330A pull request that conflicts shows **This branch has conflicts that must
331be resolved**, the conflicting files, each linked to its diff, and three
332ways to resolve them:
333
334- **Resolve with g1t.** g1t merges the target branch in,
335 resolves the conflicts keeping what both sides meant, and pushes the
336 result. It is told which files conflict. Available to whoever can push to
337 the pull request: for a pull request's fork, whoever opened it (whoever
338 asked g1t for one it made); for a branch, anyone with the Write role or
339 higher.
340- **Resolve in the browser.** Coming soon.
341- **On the command line.** The box lists the commands, each with a copy
342 button. For a pull request from a branch:
343
344 ```sh
345 git fetch origin
346 git checkout my-branch
347 git merge origin/main
348 # fix each conflicting file, then
349 git add -A && git commit --no-edit
350 git push origin my-branch
351 ```
352
353 For a pull request in its own fork, clone the fork and pull `main` into
354 it instead:
355
356 ```sh
357 git clone https://g1t.sh/pulls/<id>.git && cd <id>
358 git pull --no-rebase https://g1t.sh/<owner>/<repo>.git main
359 ```
360
361While it conflicts, it cannot be merged or added to the
362[merge queue](/guides/merge-queue/), and the merge button says so. Once the
363fix is pushed, g1t works it out again.
364
365A pull request that only has fallen behind its target, without conflicts,
366still merges: merging brings it up to date first, unless the repository
367requires pull requests to be up to date.
368
369## Catching up
370
371When the target branch has moved, the merge box says **main has moved since
372this was made**. Whoever can push to the pull request (whoever opened it,
373or asked g1t for it, for one in its own fork; anyone with the Write
374[role](/guides/access-and-roles/) or higher, for a branch) can
375press **Catch up with main now**:
376
3771. **When the two changed different files**, g1t merges `main` in itself,
378 in a few seconds. The merge commit is named **Merge main into
379 *branch***, has the pull request's head and `main`'s head as its
380 parents, and is authored and pushed as you. The box then says **Brought
381 up to date with main**, and the workflows run again on the
382 new commit, as after any push.
3832. **When both changed some of the same files**, a sandbox merges `main` in
384 with git, and [g1t](/guides/working-with-g1t/) resolves any conflict.
385 The box says what is happening (**g1t is resolving conflicts with
386 main** when the merge is known to conflict) with the run's live step and
387 how long it has taken. It usually takes about a minute. When the result
388 is pushed, the box shows the pull request up to date; if the run fails,
389 or nothing has been pushed after five minutes, the box says so and
390 offers **Try again**. Nothing is pushed by a run that fails.
391
392Either way the merge is pushed only if the pull request's branch is still
393where it was when the catch-up started. If someone pushed to it meanwhile,
394the catch-up stops with nothing lost, and you can press it again.
395
396The second case needs g1t's agent enabled for the workspace and is
397[charged](/guides/usage-and-billing/#what-is-charged) as agent work; the
398first is not.
399
400A pull request [g1t](/guides/working-with-g1t/) opened that is found to conflict
401is sent back to resolve it by itself, before it is ready.
402
403## From the API
404
405`GET /repos/{owner}/{name}/pulls/{number}` returns, besides the pull request:
406
407| Field | What it is |
408| --- | --- |
409| `statuses` | What each workflow run, and anything else that reports statuses, said about its head, with a link to the run. |
410| `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. |
411| `checks` | The latest record against its head from g1t itself, such as the merge queue taking it out, with `earlier_checks` before it. |
412| `mergeable` | `clean`, `conflicting`, `checking` or `unknown`. |
413| `conflicts` | When conflicting, the files that conflict. |
414| `behind` | Whether its target has moved on without it. |
415| `reviewers`, `team_reviewers` | The people and the [teams](/guides/teams/#review-requests) asked to review it. |
416| `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. |
417
418An agent sees the same through the `pull_request` tool's `get` action.