Git and pull requests
The branch, sync state and changes in the top bar, the diff of each change, and pull requests with their checks.
When a project is a git repository, the top bar shows its branch and state. Kettu runs your own git, and the GitHub CLI gh for pull requests.
What you need
| Tool | Used for |
|---|---|
git on your PATH | The branch, changes and commits, Fetch, Pull and Push |
| GitHub CLI, signed in | Pull requests and their checks, Create pull request…, Publish… |
After installing the GitHub CLI, sign in once in a terminal:
gh auth login Settings › Git shows whether each tool is found and which account gh is signed in as.
The top bar
The branch chip shows the branch name, then only what applies:
| Part | Meaning |
|---|---|
| Not published | The branch has no upstream yet |
| ↑ and a number | Commits to push |
| ↓ and a number | Commits to pull |
| Merging, Rebasing | A git operation is in progress |
| Red warning and a number | Files with conflicts |
| File icon and a number | Changed files |
When the branch has a pull request, a chip with its number and the state of its checks follows; clicking it opens the pull request on GitHub. Everything updates by itself as the agent works and when you come back to the window.
The branch popover
Click the branch to open it. From the top it shows:
- The branch name with a copy button, the branch it came from and the upstream it tracks.
- Pull and Push. The next step is the labelled button with its count. Hover a button to see the git command it runs, or why it cannot run.
- The pull request, when the remote is on GitHub.
- The history: commits to pull, Uncommitted changes, the branch’s commits, and how many new commits the default branch has since you branched.
- The remote, when it was last fetched, and Fetch.
Hover a commit for its whole message, author and id. Right-click it for Copy commit id, Copy message and, once it is pushed to GitHub, Open on GitHub.
Viewing diffs
Expand Uncommitted changes or a commit to list its files, each with its status letter and the lines added and removed. Click a file to open its diff in the Files pane. Open file opens the file itself, and Close diff brings back the file you had open.
Fetch, pull and push
| Button | What it does |
|---|---|
| Fetch | git fetch --prune |
| Pull | git pull --ff-only, when the branch is only behind |
| Push | Pushes the branch to its upstream |
| Publish branch | Pushes a new branch and sets its upstream |
| Publish… | For a repository with no remote: creates a GitHub repository with gh, adds it as origin and pushes |
A push straight to the default branch asks first. When the branch has diverged, or during a merge, rebase or conflicts, the popover says what to finish first, such as rebasing in the terminal. When an operation fails, it says why, and Show log shows git’s output.
To keep the ahead and behind counts current, turn on Settings › Git › Fetch in the background, which fetches every 5 minutes. It is off by default.
No commit button
Kettu does not make commits. Ask the agent to commit, or run git commit in the terminal.
Pull requests
With a GitHub remote and the GitHub CLI signed in, the popover shows the branch’s pull request: its title, state, branches, the checks with each run and how long it took, the review state and what blocks the merge. Click a check run to open it on GitHub. Kettu reads the pull request again every minute while checks run, and every 5 minutes otherwise.
Without one, Create pull request… asks for Title, Description, Base and whether it is a Draft. With one commit, the title starts as its subject; with several, as the branch name, with the commit subjects in the description. Publish the branch first.
A link to a GitHub pull request in the conversation shows as a chip; hover it for the state, checks and author.
Without the GitHub CLI
Without gh, Open on GitHub takes you to GitHub’s page for opening a pull request. If gh is installed but signed out, the popover shows gh auth login with a copy button.