Open History to see the last commit
1# Source control
2
3T3 Code integrates with GitHub, GitLab, Forgejo, Gitea, Bitbucket, Azure DevOps, GitCafe, and Cursor
4Origin to clone and publish repositories, create pull requests, and review changes.
5
6## Review turn changes
7
8A turn's changed files and diff show only the turn's own work. When a turn pulls, merges, or
9rebases, the files Git brought in are left out. A file stays in the list when the turn edited it,
10committed it, or fixed a conflict in it. Use the branch comparison to review everything that changed
11against your base branch. Restore still returns the complete saved workspace.
12
13In a [project with several repositories](multi-repo-projects.md),
14a turn's changed files are grouped by repository, and the Diff pane shows every repository the
15turn changed. Use the repository picker next to the source picker to narrow the diff to one of
16them. Paths in the diff start at the thread's folder, so the same file name in two repositories
17stays apart. This works when the project folder itself is not a Git repository; the branch
18comparison and uncommitted changes read one repository at a time, chosen from the same picker.
19
20The thread details panel lists each repository the thread has changed, most recent first, with its
21branch and uncommitted changes. Expand one to commit, push, or open a pull request in that
22repository; a pull request opened there, or already open for its branch when a turn ends, is linked
23to the thread. **Other repositories...** adds any other repository of the project to the list until you
24reload. In a worktree thread of a project with several repositories it adds a worktree of that
25repository to the thread instead; see [Worktree threads](multi-repo-projects.md#worktree-threads). A
26worktree thread of a single repository does not offer it.
27
28On web and desktop, open the Diff pane source picker and choose **Commits** to review one local
29commit at a time. The list shows the newest 100 commits in the branch comparison. A merge commit
30shows its changes against its first parent.
31
32A commit link from a supported code host opens in the Diff pane when the thread's repository has
33that commit locally, on any branch. Otherwise a pull request commit link opens the pull request. Other
34commit links follow your **Open links in** setting; on web, when that opens a new tab, T3 Code first
35shows an **Open link** button. Command/Ctrl+Click always opens the link in your browser. Commit links follow the **Open pull requests in T3 Code**
36setting in **Settings → Diffs**.
37
38## Connect an account
39
40Install Git and configure authentication on the machine running your T3 Code server. For a remote
41environment, do this on the remote machine. After signing in, open **Settings → Source control & issues**
42and choose **Rescan**.
43
44### GitHub
45
46T3 Code talks to GitHub's API directly and only needs a token. Any of these works, in this
47order of precedence:
48
491. A token saved in **Settings → Source control & issues → GitHub**. It is kept in the server's secret
50 store, and works without the GitHub CLI.
512. `GH_TOKEN` (`GH_ENTERPRISE_TOKEN` with `GH_HOST` for GitHub Enterprise Server) in the
52 server's environment.
533. [GitHub CLI](https://cli.github.com/) 2.81.0 or newer, signed in with `gh auth login`.
54
55If `gh` is signed in to several accounts or hosts, expand **GitHub** in the same place to pick
56the account each host uses or turn a host off. A saved token or `GH_TOKEN` takes precedence
57over that choice; a host turned off stays off either way.
58
59For GitHub Enterprise, sign in with `gh auth login --hostname YOUR_HOST`. T3 Code treats a
60custom server name as GitHub once it has a credential for that host.
61
62### Forgejo and Gitea
63
64Install [Forgejo CLI (`fj`)](https://codeberg.org/forgejo-contrib/forgejo-cli) or
65[Gitea CLI (`tea`)](https://gitea.com/gitea/tea) 0.16 or later on your T3 Code server.
66Sign in with `fj --host https://your-server auth add-token` or `tea login add`.
67Repeat for each server you use, including Codeberg.
68
69T3 Code prefers a matching `fj` login and falls back to `tea` when `fj` is unavailable
70or has no login for that server. Once an account is selected, failed actions stay on that
71account. Settings shows the detected CLI. Forgejo and Gitea share one integration entry.
72Servers hosted under a URL subpath, such as `https://example.com/forgejo`, use `tea` because
73fj does not preserve the subpath when checking its account.
74
75When cloning or publishing, use a full repository URL to select a specific server.
76You can use `owner/repo` when only one fj server is configured, or with your default `tea`
77login when fj is unavailable or unconfigured. With multiple fj servers, use the full URL.
78If you have multiple `tea` accounts on one server, select one with
79`tea login default <login-name>`. Git push and clone also need Git credentials or an SSH key
80for that server.
81
82### GitLab
83
84Install [GitLab CLI](https://gitlab.com/gitlab-org/cli), then sign in:
85
86```bash
87glab auth login
88```
89
90### Bitbucket
91
92Open **Settings → Source control & issues**, expand **Bitbucket**, and enter one of:
93
94- **Access token**: a token created for one repository, project, or workspace. It can only reach
95 what it was created for.
96- **Atlassian account email** and **API token**: an Atlassian API token for your account. It can
97 reach every repository you can. Give it read/write access to repositories and pull requests, plus
98 user read access (`read:user:bitbucket`) and workspace read access (`read:workspace:bitbucket`).
99
100A field saves when you leave it, and applies right away. The access token wins when both are saved.
101Credentials are saved on the environment's server, so select a remote environment to configure
102it. Saved tokens can't be viewed again; enter a new one to replace it, or choose **Remove** to clear
103everything saved for Bitbucket.
104
105If no credentials are saved, T3 Code falls back to these variables in the server's environment.
106Restart the server after changing them:
107
108```bash
109export T3CODE_BITBUCKET_ACCESS_TOKEN="your-access-token"
110# or
111export T3CODE_BITBUCKET_EMAIL="you@example.com"
112export T3CODE_BITBUCKET_API_TOKEN="your-token"
113```
114
115For a background service, put these `KEY=VALUE` entries in
116[`service.env`](./background-service.md#configure-the-service-environment)
117under T3 home, then run `t3 service restart`. Service installation and updates
118preserve that file.
119
120### Azure DevOps
121
122Install [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/), add the DevOps extension, and sign in:
123
124```bash
125az extension add --name azure-devops
126az login
127```
128
129### GitCafe
130
131Install the GitCafe CLI and sign in:
132
133```bash
134bun install -g @gitcafe/cli
135cafe auth login --host https://git.cafe/api
136```
137
138Alternatively, open **Settings → Source control & issues**, expand **GitCafe**, and enter a token. It is
139kept in the server's secret store, applies right away, and is used before `CAFE_TOKEN` and the
140`cafe` login. Or set `CAFE_TOKEN` in the server's environment and restart it. Both tokens are only
141sent to `git.cafe`; `CAFE_TOKEN` follows `CAFE_HOST` if you set it. Repositories on
142`staging.git.cafe` need their own login with `--host https://staging.git.cafe/api`.
143
144Line comments are not available for GitCafe pull requests yet.
145Merging a stack lands it through GitCafe, and updating a branch restacks the layers above it.
146
147### TanStack Source
148
149TanStack Source is in private beta, so the server shows it only when its environment turns the flag
150on: `export T3CODE_FEATURE_FLAGS=tanstack_source` in your shell profile, then restart T3 Code. Separate
151several flags with commas. A value already set in the server's own environment, such as a service
152definition, is used instead of the profile. Install its CLI and sign in:
153
154```sh
155curl -fsSL https://source.tanstack.com/install | sh
156src auth login --web
157```
158
159Alternatively, open **Settings → Source control & issues**, expand **TanStack Source**, and enter a token
160from `https://source.tanstack.com/settings/tokens`. A saved token is used before `SRC_TOKEN`, which is
161used before the `src` login. With several `src` logins, pick the account there too.
162
163Pull requests show the runs of TanStack Source CI with their logs, and update live while open. An
164agent can open a private pull request on a public repository when you ask for one: its branch goes
165to the repository's private companion and never to the repository itself. Issues
166can be listed, filed, edited, commented on and closed. Reactions and picking reviewers or assignees
167from a list are not available yet.
168
169### Cursor Origin
170
171Install the [Origin CLI](https://cursor.com/docs/origin/cli) and sign in. Signing in also sets up Git
172credentials for `origin.cursor.com`:
173
174```bash
175curl -fsSL https://downloads.cursor.com/origin/install.sh | sh
176origin auth login
177```
178
179If cloning or pushing asks for a username, run `origin auth setup-git` to point Git at the CLI's
180credentials again. Origin repositories use HTTPS and are published privately. Repositories mirrored
181from GitHub keep their pull requests on GitHub; open those from the GitHub remote.
182
183## Start, clone, or publish a project
184
185To start from nothing, choose **New project** in the command palette (`Cmd/Ctrl+K`), or
186**New project** under **Add Project** on any client, and type a name. T3 Code makes a Git
187repository in `~/.t3/projects` (the `projects` folder of your T3 data directory) with a README,
188an icon, and a first commit, then opens a new thread in it. Until the project has a thread, new
189threads work in its folder, even when your default is a new worktree. The folder is named after the project,
190like `pinball-stats` for "Pinball Stats". Turn on **Create private repository on GitHub** to also
191publish it. If Git has no name or email on that machine, the project is created without the
192first commit.
193
194Use **Add Project** in the command palette (`Cmd/Ctrl+K`) to clone a repository. Choose a hosting
195provider or paste a Git URL, then choose where to save it. Only GitHub is listed at first. To list
196another provider here and in **Publish Repository**, turn on its switch under
197**Settings → Source control & issues**. A branch or file page copied from GitHub,
198GitLab, GitCafe, Codeberg or Bitbucket also works: T3 Code clones that repository's default branch.
199On other hosts, paste the repository's clone URL. The project opens right away while the
200clone runs in the background: you can write your first prompt, and sending waits until the files
201are in place. A toast tracks progress and lets you cancel; if the clone fails, retry it from the
202toast or from the banner above the composer. When the host refuses the machine's SSH key, T3 Code
203clones over HTTPS with Git's credentials for that host instead, and the project's remote uses the
204HTTPS URL.
205
206To lay clones out like [ghq](https://github.com/x-motemen/ghq), turn on **Clone into host folders**
207under **Settings → Threads** (or **Source control** on mobile). Clones then default to
208`<host>/<owner>/<repo>` under **Add project starts in**, so set that to `~/ghq` to share ghq's
209folders. You can still change the destination before cloning.
210
211For a local Git repository without a remote, **Publish Repository** creates a hosted repository,
212adds it as `origin`, and pushes your commits. If there are no commits yet, it creates the remote;
213make your first commit before pushing.
214
215## Create a pull request
216
217Use a thread's Git actions to commit, push, and create a pull request. T3 Code can generate commit
218messages, review titles, and descriptions from your changes. Descriptions also draw on the work in
219the thread, including the checks it ran.
220
221An existing fork PR can appear beside the branch even if you pushed without setting an upstream.
222If its badge is missing because several remotes hold that branch, set the branch's upstream to
223the intended remote with `git branch --set-upstream-to=<remote>/<branch>`.
224
225Choose how commit messages and pull request titles and descriptions are written in
226**Settings → Source control & issues → Commits & pull requests**. **Repository conventions** uses the
227project's instructions and recent commit subjects. **Custom instructions** applies your own
228instructions to commits and pull requests.
229
230## Review and merge
231
232Open **Pull requests** to review changes and comments, request reviewers, check out a branch,
233or merge. You can edit review titles and descriptions and your own comments where the host allows it.
234Where you can edit a description, you can also tick its checkboxes from the Summary tab
235(the Overview tab on mobile).
236GitLab calls these merge requests.
237
238Save a filter setup with **Views → Save current view** on the Pull Requests page. For example, choose
239**Reviewing** (**Your review** on mobile) and save it as "PRs Requesting My Review". Choose a saved view to restore its search,
240filters, sort order, and server/project scope. After changing filters, use **Update saved view** to
241keep the changes, or save another view. You can also rename or delete views from the same menu.
242Saved views stay in the browser or app where you created them and do not sync across devices.
243
244A link to part of a pull request opens that part: a comment or review is marked in the activity, a
245changed-line link opens the file at those lines, a checks link opens the checks, and a commit link
246opens that commit's changes. On web and desktop, hovering a comment or commit link previews it.
247
248On mobile, **Pull requests** lists reviews across your connected environments. Open a review
249to read its description, activity, commits, and changed files. Line comments stay as drafts
250until you submit the review. **Work on PR** opens a chat with the review attached; sending
251the first message prepares a worktree from the review's branch.
252
253Previously loaded lists, review details, guides, and diff pages remain readable on mobile
254without a connection, including after restarting the app. Saved content refreshes when the
255environment reconnects; submitting changes requires a connection.
256
257Enable **Remove agent credits when merging** in Settings → Source control & issues to remove recognized
258agent co-author and generated-by lines from GitHub merge and squash commit messages. Human
259co-authors stay credited. The setting is off by default and projects can override it. It also
260applies to auto-merge, but not merge queues or native stack merges. Original commits keep their
261messages, so merge and rebase can still retain agent credits in those commits.
262
263On web and desktop, hold **Shift** in the GitHub pull request list for quick actions.
264To close several, press **Close**, drag across the rows in the same group, and release.
265Press **Escape** before releasing to cancel. Failed closes stay in the list so you can retry them.
266
267GitHub, GitLab, and Azure DevOps support auto-merge while checks are outstanding. GitHub also
268supports approving waiting fork workflows and opening a revert pull request for a merged change.
269
270Pull request sharing is off by default. In Settings → Environments → Pull request sharing (Pull
271request routing under Environments on mobile), choose **Read PRs** or **Read and act** for each
272environment you trust to share its source control access.
273Enable both the original environment and the environment answering its requests on this client.
274**Read and act** can use broader permissions than the original environment's credential;
275only enable it for environments you control and trust. Changing a saved endpoint or removing an
276environment clears its permission.
277
278Review details, linked PR status, and permitted review actions can then use another connected
279environment signed in to the same account on the same host. Each needs a project on that host.
280A connected local environment is preferred for actions and can answer slow or failed reads.
281Browsers and mobile clients need a paired environment to use its GitHub credentials.
282Credentials stay on their machines. Previously verified credentials remain usable for routing
283for ten minutes during a GitHub outage; new credentials must be verified first. An action with
284an uncertain result is never automatically retried elsewhere. Listings, diffs, and checkout or
285PR creation from Git actions continue to use the project's environment.
286
287For Azure DevOps, use the host website to change comments. Bitbucket does not support reopening a
288declined pull request.
289
290### Review guides
291
292Review guides are in beta. Turn on **Review guides** in Settings → Source control & issues to add the
293**Guide** tab to pull requests on that server. On mobile, move between stops with **Next**
294and the back button; a stale guide offers a rewrite and hides excerpts that no longer match
295the current change.
296
297The **Guide** tab gives you a tour of a pull request without reading it line by line: stops
298through the change in reading order. Each stop points at the lines worth reading, and a stop marked
299**Look closely** has a call only a maintainer can make. Mechanical changes such as renames and
300snapshots are grouped at the end, and every changed file appears somewhere on the tour.
301Conversations already resolved in review are left out. For a pull request in a stack, the guide
302covers that layer only, and may point out what a lower layer introduced or what a higher one uses.
303
304Choose **Write guide** to have the review guide model from Settings → Source control & issues read the
305change in a temporary checkout; without one set, the source control writer model is used. Nothing
306in the checkout is changed, and a large pull request takes a few minutes; you can go elsewhere in
307the app. On web, you are told when the guide is ready; on mobile, return to the guide to check
308its progress. Claude and Codex can write guides. The guide is
309kept for everyone using this server. To write it again, for example after a push or after changing
310the model or instructions, choose **Rewrite guide** from the pull request's **⋯** menu.
311
312On web, while reading a stop, select lines in an excerpt to add a comment to your review or ask an agent
313about them; comments wait with the ones from the **Code** tab until you send the review. Choose a
314suggested question, or **Ask about this stop**, to open a thread that already knows which stop you
315are on. **Finish review** on the last stop opens the review with everything you collected.
316
317Agents can write guides too: ask one to prepare guides for a set of pull requests, and it starts
318them for you. Each is read through the project whose checkout has that repository.
319
320To shape guides to your taste, write **Review guide instructions** in Settings → Source control & issues,
321such as what to show first or what to skip; projects can override them. They change emphasis and
322ordering, not the guide's layout or which files it covers.
323
324### Mark files as viewed
325
326Tick a file off in the **Code** tab once you have read it and it collapses; the toolbar keeps a
327running count. A tick belongs to the pull request rather than to a commit, so scoping the tab to a
328single commit keeps them. A file pushed to after you cleared it comes back marked **Changed**.
329
330On GitHub these are GitHub's own viewed marks, so a review carries between T3 Code and github.com
331in either direction. Forgejo, GitLab, Bitbucket, Azure DevOps, and Cursor Origin expose no record
332T3 Code can read, so the server you are connected to keeps them instead: they follow you across the
333apps connected to that server, but the host's own site will not show them, and the count reads **viewed in T3 Code**.
334
335On mobile, open a changed file and mark it viewed from its header. Viewed files collapse,
336and their marks follow the same rules as on web and desktop.
337
338## Troubleshooting
339
340- **Not authenticated:** run the provider's login command on the server, then rescan. For Bitbucket,
341 check the credentials saved in Settings → Source control & issues, or confirm the running server received
342 the environment variables.
343- **GitHub sign-in cannot be verified:** update GitHub CLI to at least 2.81.0, or save a token in Settings → Source control & issues.
344- **Push fails despite a connected account:** check the Git remote's credentials. SSH and HTTPS
345 remotes can require separate setup from the hosting provider's API access.
346- **A review cannot load:** open it on the host website while resolving connectivity, permissions,
347 or rate limits.
348
349## Linked pull requests
350
351A thread can hold several pull requests, including reviews from another repository on the same host.
352Use **Link pull request** in the command palette or **Linked items** panel, or right-click a
353pull request link in the conversation. Creating a pull request from Git actions links it automatically,
354and so does an agent creating one with `gh pr create` or `glab mr create`. Agents can link other
355pull requests with the `link_pull_request` tool.
356
357Agents can also read, open, update, reply on, and merge pull requests in the thread's repository
358through T3 Code's own tools, which use the same sign-in as the Pull requests page. An agent merges
359only the commit it last read: if someone pushed since, the merge is refused. On github.com an
360agent can also land a GitHub stack in one merge, like **Merge stack** below.
361
362Use **Link pull request to thread** in the command palette to keep a pull request with the thread. From a review
363on the Pull requests page, **Link to thread** lets you search for an active thread. The review header
364also lists the threads that link to it, including archived threads, so you can return to their context.
365
366Thread badges show a stack's layer count or the current review number with a count of additional
367links. Clicking a badge with more than one review opens the **Linked items** panel. On mobile, the Git overview lists linked reviews and their stacks; tap a review to open it.
368Linking and unlinking are available in the web and desktop clients.
369
370The **Linked items** panel lists every review and groups stacks. Unlink a review from its
371row menu. An unlinked stack layer stays out of later syncs. Open linked reviews refresh on the server;
372closed reviews refresh periodically so reopening one on the host is detected. Merged reviews refresh
373when requested. Settling a thread refreshes its open and closed reviews once; after that they stop refreshing until you unsettle it. With **Auto-settle merged threads** enabled, a thread can settle after every linked
374review is terminal. An open or unsynced link keeps it active.
375
376Ask the agent to watch, monitor, or babysit a pull request and it calls `watch_pull_request`. While
377the thread is active, the server checks the pull request every two minutes and wakes the agent when a
378check fails or waits for a maintainer's approval, the required checks pass, the other checks finish after a failure, someone else comments or reviews, or the branch starts to
379conflict. On github.com it also wakes the agent, with GitHub's reason, when the merge queue drops
380the pull request without merging it. Threads in a project that watch the same pull request share one check. On GitHub, a check
381first asks whether anything changed and reads the pull request only when it did, which keeps
382watching inside GitHub's rate limit. Comments from your own account do not wake it. When the pull
383request merges or closes, watching ends, and the agent is woken once unless it merged or closed the
384pull request itself with the host's CLI. A reopened pull request needs a new watch. Watching also ends after 10 wakes in a row that bring only comments, after 8
385failed reads in a row, or when you press Stop on the thread. A rate limit only pauses watching.
386Settling or archiving a thread also ends all its watches. Unsettle the thread before starting a new
387watch. Watching a pull request again does not repeat check or conflict news its last
388watch already reported; unlinking the pull request clears that. Subagents cannot watch pull requests; the thread that delegated to them does. To start or stop
389it yourself, use the row menu in the **Linked items** panel. In the thread details card, a
390watched pull request shows an eye; click it to stop watching.
391
392A watched thread counts as working while the pull request still has checks running, so it stays in
393the **Working** section, including after the agent pushes a fix. Once every check has finished,
394including review bots that report as checks, the thread returns to your inbox: what happens next is
395up to a person. That includes a workflow waiting for a maintainer to approve it, which runs only
396once someone does. If you ask the agent to act on the pull request itself, such as merging it once
397a teammate approves, the thread stays in **Working** until the pull request merges or closes. The
398watch stays on and still wakes the agent on new comments, failed checks or conflicts, and a watched
399thread never auto-settles.
400
401Cross-repository links use a project on the same host. Azure DevOps reviews require a project checked
402out from the matching organization and repository.
403
404## Issues
405
406The Issues page lists the issues of every project whose remote is on GitHub, GitLab, Azure
407DevOps or Forgejo, grouped per tracker account. Open it from the sidebar's utility row or with
408**Open issues** in the command palette. Filter by open or closed, by your involvement
409(assigned, opened by you, mentioning you), and by tracker. Under **Projects**, uncheck the
410projects you do not want to see; the list remembers them, and a project you add later shows.
411The search box asks the tracker itself where it can search. Press **Load more** at the end of a group to read further back.
412The **Views** menu saves and restores a search, filter, and sort setup, as it does for pull
413requests.
414
415To list Linear issues beside a project's, connect Linear with an API key under
416Settings → Source control & issues, then pick one or more teams for that project there. Pick
417another team at any time to add it; uncheck every team to unbind the project. Each team's
418issues appear in the Linear group of the issue list, sorted with the rest by last update, and
419each can be loaded further on its own. Agents file new issues in the first team picked unless you name another bound team.
420
421Select an issue to open it beside the list: description, comments, state changes, linked pull
422requests, labels, assignees, and reactions. Linked pull requests open in the same panel. You can
423comment, edit the title and description, change labels and assignees, react, and close or
424reopen (with a close reason where the tracker records one) when the tracker and your account
425allow it. An issue read through a project that does not own its repository is shown read-only.
426
427An issue can be kept with a thread the way a pull request can: open it beside the thread (issue
428links in the conversation open there) and use **Link to this thread** in its header; **Unlink**
429undoes it. Click the issue badge in the thread sidebar to see its issues and pull requests in
430**Linked items**. Select an issue there to open it beside the thread. Agents link the issues they
431work on with the `link_issue` tool.
432
433Writing to a tracker over a remote connection requires the `source-control:write` scope.
434
435## GitHub stacks
436
437The Pull requests page shows each PR's position in its GitHub stack. Open the stack badge in a
438review to navigate its layers. **Merge stack** submits the selected pull request and every unmerged
439layer below it to GitHub together, respecting branch rules and merge queues. The confirmation shows
440the scope and merge strategy. GitHub rebases the remaining stack after merging.
441
442**Rebase stack** updates remote branches from bottom to top without changing your local checkout.
443It can rewrite history and restart checks. If a layer fails, earlier updates remain; resolve that
444layer before retrying. GitHub may require manual conflict resolution after a lower layer is amended,
445even when its changes look independent. Stack actions require an environment that supports them.