Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

source-control.md

129 lines5.5 KB

1# Source control
2​
3T3 Code integrates with GitHub, GitLab, Bitbucket, and Azure DevOps to clone and publish
4repositories, create pull requests, and review changes.
5​
6## Connect an account
7​
8Install Git and configure authentication on the machine running your T3 Code server. For a remote
9environment, do this on the remote machine. After signing in, open **Settings → Source Control**
10and choose **Rescan**.
11​
12### GitHub
13​
14Install [GitHub CLI](https://cli.github.com/) 2.81.0 or newer, then sign in:
15​
16```bash
17gh auth login
18```
19​
20### GitLab
21​
22Install [GitLab CLI](https://gitlab.com/gitlab-org/cli), then sign in:
23​
24```bash
25glab auth login
26```
27​
28### Bitbucket
29​
30Set an access token in the server's environment:
31​
32```bash
33export T3CODE_BITBUCKET_ACCESS_TOKEN="your-access-token"
34```
35​
36Or use an Atlassian account email and API token with read/write access to repositories and pull
37requests, plus user read access (`read:user:bitbucket`):
38​
39```bash
40export T3CODE_BITBUCKET_EMAIL="you@example.com"
41export T3CODE_BITBUCKET_API_TOKEN="your-token"
42```
43​
44The access token takes precedence if both are configured. Restart the server after changing these
45variables.
46​
47### Azure DevOps
48​
49Install [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/), add the DevOps extension, and sign in:
50​
51```bash
52az extension add --name azure-devops
53az login
54```
55​
56## Clone or publish a project
57​
58Use **Add Project** in the command palette (`Cmd/Ctrl+K`) to clone a repository. Choose a hosting
59provider or paste a Git URL, then choose where to save it.
60​
61For a local Git repository without a remote, **Publish Repository** creates a hosted repository,
62adds it as `origin`, and pushes your commits. If there are no commits yet, it creates the remote;
63make your first commit before pushing.
64​
65## Create a pull request
66​
67Use a thread's Git actions to commit, push, and create a pull request. T3 Code can generate commit
68messages, review titles, and descriptions from your changes.
69​
70Choose the writing style and model in **Settings → Source Control**. **Repository conventions**
71uses the project's instructions and recent commit subjects.
72​
73## Review and merge
74​
75Open **Pull requests** to review changes and comments, request reviewers, check out a branch,
76or merge. You can edit review titles and descriptions and your own comments where the host allows it.
77GitLab calls these merge requests.
78​
79GitHub, GitLab, and Azure DevOps support auto-merge while checks are outstanding. GitHub also
80supports approving waiting fork workflows and opening a revert pull request for a merged change.
81​
82For Azure DevOps, use the host website to view diffs or change comments. Bitbucket does not support
83reopening a declined pull request.
84​
85## Troubleshooting
86​
87- **Not authenticated:** run the provider's login command on the server, then rescan. For Bitbucket,
88 confirm the running server received the environment variables.
89- **GitHub sign-in cannot be verified:** update GitHub CLI to at least 2.81.0.
90- **Push fails despite a connected account:** check the Git remote's credentials. SSH and HTTPS
91 remotes can require separate setup from the hosting provider's API access.
92- **A review cannot load:** open it on the host website while resolving connectivity, permissions,
93 or rate limits.
94​
95## Linked pull requests
96​
97A thread can hold several pull requests, including reviews from another repository on the same host.
98Use **Link pull request** in the command palette or **Linked pull requests** panel, or right-click a
99pull request link in the conversation. Creating a pull request from Git actions links it automatically.
100Agents can link their pull requests with the `link_pull_request` tool.
101​
102Use **Link this PR** in a branch-detected badge's tooltip to keep it with the thread. From a review
103on the Pull Requests page, **Link to thread** lets you search for an active thread. The review header
104also lists the threads that link to it, including archived threads, so you can return to their context.
105​
106Thread badges show a stack's layer count or the current review number with a count of additional
107links. On mobile, the Git overview lists linked reviews and their stacks; tap a review to open it.
108Linking and unlinking are available in the web and desktop clients.
109​
110The **Linked pull requests** panel lists every review and groups stacks. Unlink a review from its
111row menu. An unlinked stack layer stays out of later syncs. Open linked reviews refresh on the server;
112closed reviews refresh periodically so reopening one on the host is detected. Merged reviews refresh
113when requested. With **Auto-settle merged threads** enabled, a thread can settle after every linked
114review is terminal. An open or unsynced link keeps it active.
115​
116Cross-repository links use a project on the same host. Azure DevOps reviews require a project checked
117out from the matching organization and repository.
118​
119## GitHub stacks
120​
121The Pull Requests page shows each PR's position in its GitHub stack. Open the stack badge in a
122review to navigate its layers. **Merge stack** submits the selected pull request and every unmerged
123layer below it to GitHub together, respecting branch rules and merge queues. The confirmation shows
124the scope and merge strategy. GitHub rebases the remaining stack after merging.
125​
126**Rebase stack** updates remote branches from bottom to top without changing your local checkout.
127It can rewrite history and restart checks. If a layer fails, earlier updates remain; resolve that
128layer before retrying. GitHub may require manual conflict resolution after a lower layer is amended,
129even when its changes look independent. Stack actions require an environment that supports them.