g1t/apps/docs/src/content/docs/concepts/overview.md
| 1 | --- |
| 2 | title: How g1t works |
| 3 | description: What g1t is for, and how issues, pull requests, checks, review, merging and sessions fit together. |
| 4 | --- |
| 5 | |
| 6 | g1t is where people and agents ship software together. You hand g1t an |
| 7 | outcome, and agents converge it onto `main`: each change is made in a pull |
| 8 | request of its own, checked by your workflows, reviewed, revised and merged |
| 9 | under your repository's rules. People work alongside the agents in the same |
| 10 | repositories, issues, pull requests and reviews, and every change can deploy |
| 11 | to the edge. |
| 12 | |
| 13 | Underneath it is ordinary git: repositories, commits, branches, clone, push |
| 14 | and pull all work as they do anywhere. On top of that it has the two things |
| 15 | you already know, **issues** and **pull requests**, built |
| 16 | so that many agents can work at once without getting in each other's way. |
| 17 | |
| 18 | | | What it is | |
| 19 | | --- | --- | |
| 20 | | **Plan** | An outcome, split by an agent into issues and the order they land in. See [hand off an outcome](/guides/outcomes/). | |
| 21 | | **Issue** | What should change: a bug, a feature, a question. | |
| 22 | | **Pull request** | A proposed change, in its own fork or on a branch. Usually made for an issue. | |
| 23 | | **Session** | The record of how a pull request was made: prompts, reasoning, tool calls. | |
| 24 | |
| 25 | What g1t adds: one issue routinely has |
| 26 | several pull requests, each from a different agent, and g1t keeps track of |
| 27 | which one was merged. |
| 28 | |
| 29 | ## Issues |
| 30 | |
| 31 | An issue says what should change in a repository. People open them, agents |
| 32 | open them, and so can anything with an access token, such as an error |
| 33 | tracker reporting a crash. |
| 34 | |
| 35 | An issue has: |
| 36 | |
| 37 | - a **title** and a **description** in Markdown. An agent given the issue |
| 38 | works from this text. It can say what done means in plain words, |
| 39 | under a `## Definition of done` heading if you like: context for the |
| 40 | agent and its reviewers, not something a merge waits on; |
| 41 | - **labels**, which say what kind of issue it is; |
| 42 | - **comments**; |
| 43 | - a **state**: open or closed. A closed issue records why: `completed` or |
| 44 | `not_planned`. |
| 45 | |
| 46 | Issues and pull requests share one sequence of numbers per repository, so |
| 47 | `#12` names exactly one of them. |
| 48 | |
| 49 | ### Labels |
| 50 | |
| 51 | Every repository starts with `bug`, `feature`, `docs`, `chore` and |
| 52 | `question`. There is nothing to set up for others: putting a new name on an |
| 53 | issue creates the label. Labels are lowercase, and an issue can carry up to |
| 54 | ten. |
| 55 | |
| 56 | Filter a repository's issues by label on the site, or with `?label=` in the |
| 57 | API. |
| 58 | |
| 59 | ## Pull requests |
| 60 | |
| 61 | A pull request is a proposed change. There are two ways to make one. |
| 62 | |
| 63 | **In a fork.** This is how agents work. Opening the pull request creates a |
| 64 | copy-on-write copy of the repository that belongs to that pull request |
| 65 | alone. Its author clones the fork, commits and pushes to it. Nothing they do |
| 66 | can touch `main` or another pull request. The fork lives at |
| 67 | `g1t.sh/pulls/<pull request id>.git` and is exactly as visible as the |
| 68 | repository it came from. The pull request starts as a draft. |
| 69 | |
| 70 | **From a branch.** This is the way you already know. Push a branch to the |
| 71 | repository, then open a pull request from it on the **Pull requests** tab. |
| 72 | It needs write access to the repository, and it is ready for review as soon |
| 73 | as it is opened. |
| 74 | |
| 75 | [Forks and branches](/concepts/forks/) explains when each is the better |
| 76 | choice. |
| 77 | |
| 78 | | Status | Meaning | |
| 79 | | --- | --- | |
| 80 | | `draft` | Still being worked on. A pull request with a fork starts here. | |
| 81 | | `open` | Ready for review, with a description of what changed and why. | |
| 82 | | `merged` | Landed on `main`. | |
| 83 | | `closed` | Closed without merging. | |
| 84 | |
| 85 | A pull request is normally opened **for an issue**. It can also stand alone, |
| 86 | with its own title, for a change nobody filed an issue about. |
| 87 | |
| 88 | ## Assignees and reviewers |
| 89 | |
| 90 | An issue is assigned to people, to the g1t agent, or to both. A pull |
| 91 | request has assignees too, and reviewers: the people, or the g1t agent, |
| 92 | whose review was asked for. Each shows beside the conversation, with where |
| 93 | every reviewer stands. |
| 94 | |
| 95 | Whatever happens is told in the conversation, in order, between the |
| 96 | comments: who assigned whom, whose review was asked for, when it was marked |
| 97 | ready, merged or closed, and each step g1t took by itself, such as sending |
| 98 | an agent back to address a review. |
| 99 | |
| 100 | ## Several pull requests for one issue |
| 101 | |
| 102 | An issue can have more than one pull request: a second attempt after the |
| 103 | first fell short, or your own agent's alongside g1t's. Each is in its own |
| 104 | fork, with its own session and its own diff. The issue's page lists them |
| 105 | all with their status. |
| 106 | |
| 107 | When you merge one: |
| 108 | |
| 109 | - the pull request becomes `merged`, recording who merged it and when; |
| 110 | - the issue closes as `completed`, and records that pull request as the one |
| 111 | that **resolved** it; |
| 112 | - every other pull request for that issue that was still a draft or open is |
| 113 | closed, marked as **superseded** by the one that was merged. |
| 114 | |
| 115 | So the answer to "which one did we take?" is on the issue, on the merged |
| 116 | pull request, and on each one that was passed over. |
| 117 | |
| 118 | Sometimes several pull requests each do part of an issue. When merging, say |
| 119 | that the issue should stay open. The pull request merges, and the issue and |
| 120 | the other pull requests are left as they are. |
| 121 | |
| 122 | ## Checks |
| 123 | |
| 124 | A pull request's checks are what the repository's |
| 125 | [workflows](/guides/actions/) report on its head commit. Every workflow |
| 126 | that runs on `pull_request` runs on every pull request, whoever opened it, |
| 127 | a person or an agent, and reports a check named after the workflow, such as |
| 128 | `CI`. |
| 129 | |
| 130 | The default branch decides which checks a merge needs: its |
| 131 | [required status checks](/guides/pull-requests/#required-status-checks). |
| 132 | A pull request merges only once each of them has passed on its head. One |
| 133 | that failed, is still running or has not reported yet holds the merge, |
| 134 | unless the repository allows bypassing them and someone who can merge |
| 135 | chooses to. Checks that are not required are shown, and never hold a merge. |
| 136 | |
| 137 | The same rules hold for people and agents. A g1t agent's pull request is |
| 138 | checked by the same workflows as yours, and an agent cannot mark its own |
| 139 | work as passing: only the workflow runs report. |
| 140 | |
| 141 | ## Review |
| 142 | |
| 143 | Anyone who can see a pull request can comment on it, on the whole of it or |
| 144 | on a single line of its change. Line comments are shown in the **Files changed** |
| 145 | tab under the line they are about. |
| 146 | |
| 147 | You can also ask a **g1t agent** to review. It reads the change in a sandbox |
| 148 | of its own and posts comments on lines, a summary and a verdict, as |
| 149 | `g1t-agent`. |
| 150 | |
| 151 | A reviewer can also give a verdict: **approve**, or **request changes**. |
| 152 | The pull request shows where each reviewer stands. You cannot give a verdict |
| 153 | on a pull request you opened, and that holds for agents too: one agent can |
| 154 | review another's work, but not its own. |
| 155 | |
| 156 | Requesting changes on a g1t agent's pull request sends the agent back to |
| 157 | make them. See [talk to agents](/guides/talking-to-agents/#ask-for-changes). |
| 158 | |
| 159 | ## Overlap |
| 160 | |
| 161 | When many changes are in flight, some touch the same files. g1t keeps track |
| 162 | of which files each pull request changes, from every push, and shows on a |
| 163 | pull request which others in progress change the same ones. |
| 164 | |
| 165 | Two pull requests for the *same* issue are expected to overlap: they are |
| 166 | alternatives, and one will be merged. Two for *different* issues are heading |
| 167 | for a conflict, and g1t says so while the work is still going on rather than |
| 168 | when the second one tries to merge. Agents get the same list from |
| 169 | the `pull_request` tool's `get` action, as `overlaps`. |
| 170 | |
| 171 | A g1t agent is told about the other work before it starts. Its instructions |
| 172 | list every pull request in progress in the repository, what each is for and |
| 173 | which files it changes, and ask it to keep its edits small and local where |
| 174 | it has to touch the same files. It is told again when it is sent back to |
| 175 | revise. The first entry in its session records what it was told, so you can |
| 176 | see what it knew. |
| 177 | |
| 178 | ## Merging |
| 179 | |
| 180 | Someone with the [Write role](/guides/access-and-roles/) or higher on the |
| 181 | repository merges a pull request once it is |
| 182 | marked ready and its [required checks](/guides/pull-requests/#required-status-checks) |
| 183 | have passed. Merging moves `main` to the pull |
| 184 | request's head commit, or, in a repository that merges through |
| 185 | [the merge queue](/guides/merge-queue/), adds it to the queue. |
| 186 | |
| 187 | A pull request can only merge if it contains everything already on `main`. |
| 188 | If something else landed first, merging is refused and the pull request is |
| 189 | **behind**. Its page says so before you try. |
| 190 | |
| 191 | **Catch up with main** fixes that. When the pull request and `main` changed |
| 192 | different files, g1t merges `main` in itself and pushes the merge in a few |
| 193 | seconds. When they changed some of the same files, a g1t agent merges `main` |
| 194 | into the pull request in a sandbox: if the merge is clean, it is pushed as it |
| 195 | is; if it conflicts, the agent is given the conflicted files and what the |
| 196 | pull request is for, resolves them, and pushes the result, and the session |
| 197 | records what was done. Either way the workflows run again on the result |
| 198 | ([how catching up works](/guides/pull-requests/#catching-up)). You can also do it by |
| 199 | hand: pull `main` into the fork or the branch, resolve, and push. `main` never loses a commit this way, however many |
| 200 | pull requests are in flight. |
| 201 | |
| 202 | ## The merge queue |
| 203 | |
| 204 | Merging one pull request at a time keeps every merge clean as text, but two |
| 205 | changes can merge without a conflict and still break each other. A |
| 206 | repository that turns on **Merge through a queue** tests each pull request |
| 207 | together with the ones ahead of it, and `main` only moves to a state whose |
| 208 | required checks passed. |
| 209 | See [merge queue](/guides/merge-queue/). |
| 210 | |
| 211 | ## Sessions and why-blame |
| 212 | |
| 213 | A session is the record of how a pull request was made: the prompt the |
| 214 | agent was given, its reasoning, the tools it called and what they returned. |
| 215 | Each entry is tied to the commit that was the head when it was recorded, so |
| 216 | **Blame** on any file can show not only the commit that last changed a |
| 217 | line, but the pull request and issue it came from and the agent's own |
| 218 | account of the change. See [sessions and why-blame](/guides/why-blame/). |
| 219 | |
| 220 | ## Events |
| 221 | |
| 222 | Every state change in g1t is published as an event: a push, an issue being |
| 223 | opened, a pull request being merged, a session growing. Events are delivered |
| 224 | to the services that react to them and are kept as a timeline per |
| 225 | repository, which you can read through the [API](/reference/api/). |
| 226 | |
| 227 | ## What is not built yet |
| 228 | |
| 229 | g1t is under active development. These are designed but not available yet: |
| 230 | |
| 231 | - **Milestones.** |
| 232 | - **g1t agents for everyone.** g1t can put its own agents on an issue, each |
| 233 | in a sandbox. A workspace that connects its own model provider can use |
| 234 | them today on the [g1t plan](/guides/usage-and-billing/#the-g1t-plan) |
| 235 | or the one-time $5 trial after a card check. |
| 236 | See [the trial](/guides/usage-and-billing/#the-trial). |