Skip to content

Git

Tyrn has built-in git support. The git panel shows your working tree and the staging area. Changes you make on the command line show up right away. For anything Tyrn doesn’t cover, use the terminal.

Git panel

Open it with ctrl-shift-g or the git button in the status bar. It shows the repository and branch, each changed file, and its staging state. The panel has a Changes tab and a History tab (cmd-1 and cmd-2).

Task Keybinding
Toggle focus on the git panel ctrl-shift-g
Stage or unstage the selected entry space
Stage a range shift-space
Stage or unstage the file cmd-y, cmd-shift-y
Stage all, unstage all cmd-ctrl-y, cmd-ctrl-shift-y
Restore the selected file backspace (confirms), cmd-backspace (no prompt)
Commit cmd-enter
Amend cmd-shift-enter
Expand the commit editor shift-escape

Useful settings:

settings.json
{
"git_panel": {
"dock": "right",
"tree_view": false,
"status_style": "icon",
"sort_by": "path",
"group_by": "status",
"entry_primary_click_action": "project_diff",
"commit_editor": "expanded",
"show_count_badge": false,
"commit_title_max_length": 0
}
}

entry_primary_click_action is "project_diff" (default), "file_diff" or "view_file". Set tree_view to true to group files by folder.

Project diff

Open every change in one view with ctrl-g d while the git panel is focused, or run git: diff from the command palette. The project diff is a multibuffer, so you can edit in it.

  • cmd-y stages the current hunk and jumps to the next. cmd-shift-y unstages it.
  • cmd-alt-z restores a hunk.
  • cmd-' expands or collapses the selected hunks in a normal editor, and cmd-" expands all of them. escape collapses them.
  • cmd-f8 and cmd-shift-f8 go to the next and previous hunk.

Diffs are "split" (side by side) by default. Set diff_view_style to "unified" for a single column. In narrow editors Tyrn switches to unified on its own, below minimum_split_diff_width (100). Changed words inside a modified line are highlighted. Turn that off with word_diff_enabled.

Commit

Type a message in the box at the bottom of the git panel and press cmd-enter to commit what is staged. Commit messages use a preferred line length of 72. Change that with preferred_line_length under languages > Git Commit.

To undo the last commit and keep its changes in your working tree, run git: uncommit from the command palette.

Generate commit message

Focus the commit message box and press alt-tab, or use the generate button, to have a harness write the message. This uses the harness and role you choose in Settings > Agents > Assistant. See Explain, rewrite and commit.

Commit messages from the command line

To use Tyrn as the editor for git commit, install the CLI (see Install Tyrn) and run:

Terminal window
git config --global core.editor "tyrn --wait"

Fetch, push and pull

Use the buttons in the git panel, or the git panel chord keys. Press ctrl-g then a key while the panel is focused.

Task Keybinding
Fetch ctrl-g ctrl-g
Push ctrl-g up
Force push ctrl-g shift-up
Pull ctrl-g down
Pull with rebase ctrl-g shift-down

When you push, Tyrn follows git’s own rules. It uses the branch’s pushRemote, then remote.pushDefault, then the tracking remote. If the repository has several remotes, a remote selector appears next to the push and pull buttons.

Branches

Switch or create branches with the branch picker: cmd-ctrl-b, or git: switch and git: branch in the command palette. You can delete a branch from the picker. You can’t delete the branch you have checked out.

Worktrees

A git worktree is a second checkout of the same repository in its own folder. Tyrn creates them in the folder set by git.worktree_directory, which is "../worktrees" by default, relative to the repository. Open the worktree picker with cmd-ctrl-w.

Worktrees are also how agent sessions run side by side without touching each other’s files. See Run sessions in parallel.

Stash

Run git: stash all, git: stash tracked or git: stash staged from the command palette or the git panel menu. Each asks for an optional name. Open the stash list with git: view stash. From it you can view, apply, pop or drop a stash. git: stash apply and git: stash pop act on the latest stash.

Blame

Blame for the current line shows at the end of the line. Turn it off or change it under git.inline_blame:

settings.json
{
"git": {
"inline_blame": { "enabled": true, "delay_ms": 0, "show_commit_summary": false }
}
}

cmd-alt-g b opens the full blame view for the file. cmd-k cmd-b shows blame for the current line in a popover.

File history

Right-click a file in the project panel, the git panel or its tab, and choose View History to see the commits that touched it. Selecting a commit opens a diff of that file in that commit.

Merge conflicts

Conflicting regions are highlighted in the file, with buttons above each one to keep your side, the incoming side, or both. After you resolve every conflict, stage the file and commit.

Git integrations

Commit hashes and issue, pull request and merge request references become links for GitHub, GitLab, Bitbucket, SourceHut, Tangled and Codeberg. Tyrn detects self-hosted servers from their remote URL. If yours isn’t picked up, add it:

settings.json
{
"git_hosting_providers": [
{ "provider": "gitlab", "name": "Corp GitLab", "base_url": "https://git.example.corp" }
]
}

provider can be github, gitlab, bitbucket, gitea, forgejo, sourcehut, tangled or gitiles.

To share code, run editor: copy permalink to line or editor: open permalink to line from the command palette, or right-click and choose Copy Permalink to Line.

Turn git off

Set git.disable_git to true to turn off every git feature, or turn off single features with git.enable_status and git.enable_diff.