# Git in the window

> The Git window in Buff Code: what changed, a commit with a message from the agent, push, branches, history. The branch chip shows the state and opens it.

Under the input field there is the **⎇ branch ±N** chip: the current branch and the number of changed files, and if the branch
has diverged from the remote one — ↑ and ↓ arrows. A click opens the **Git window** with three tabs:
“Changes”, “Branches”, “History”.

The window watches the disk: the agent’s changes, commands in the terminal and your edits in an editor show up
without a reload.

## Changes

_Illustration: Working copy changes: the files that will go into the commit are checked._

- **Files** — with a check mark showing whether the file goes into the commit, and a state: “modified”, “new”,
  “deleted”, “conflict”.
- **Commit message** — write it yourself or click **“Compose the message”**: the agent reads
  the changes of the checked files and the session’s conversation and suggests a message in the style of the recent
  commits. You can edit it before committing. In a long session the answer may take a minute or two.
- **“Commit”** — commit the checked files. **“Commit and push”** — commit and
  push to the remote repository.
- At the bottom there is the sync line: “main · in sync with origin/main” or how many commits ahead and
  behind, with a push button.

If a commit or push fails, the reason is written in words under the buttons: no remote branch,
a server refusal, a conflict. “Compose the message” works in a session that already has a conversation: before the first
message the window says so.

## Branches

The list of the project’s branches: the current one is marked, and you can **switch** to any other; at the bottom — “New
branch from the current state” and **“Create and switch”**. If the working copy has uncommitted
changes, the tab warns: on switching they stay in the working copy, and if they get in the way,
git refuses and they need to be committed first.

_Illustration: Branches: a warning about uncommitted changes before switching._

## History

Commits of all branches over time — as a line with dots: branch and tag labels (`HEAD → main`,
`origin/main`), the message, the short hash, the author and the date. A long history loads more with the
“Show more” button.

_Illustration: History: branch labels, message, hash, author and date._

## In the console

- The branch is in the line under the input field.
- `/commit` — the list of files that will go into the commit, and a confirmation; `/push` — push the branch.
- `/diff` — view the changes.
