# Git

Source: https://athas.dev/docs/git

Stage and commit changes, manage branches, and review diffs, history and blame.

Open a folder that is a Git repository and click the Git icon in the sidebar. The Source Control
panel lists your changes; branches, history, stashes and [worktrees](https://athas.dev/docs/git-worktrees) are in
the same sidebar.

GitHub account features are separate from local Git operations. See
[Dashboard integrations](https://athas.dev/docs/dashboard-integrations#github) for pull requests, issues and
account access. On Windows, repositories inside WSL workspaces work through Athas' WSL path
bridge; see [WSL](https://athas.dev/docs/wsl).

## Stage and commit

The Source Control panel groups files into:

- **Staged Changes**: files ready to commit
- **Changes**: modified files not yet staged
- **Untracked**: new files Git does not track yet

Click the `+` icon to stage a file, or the checkmark to commit. `Cmd/Ctrl+Enter` commits staged
changes. Stashes save and restore work in progress.

Save edited files before inspecting status. Stage only the changes you intend to include, review
the staged diff, then commit. Local commits and remote pushes are separate operations; check the
active project and branch before publishing work.

## Branches

The current branch is shown in the status bar. Click it to switch branches, or open the branch
manager for everything else:

- **Create**: click **New Branch**, enter a name and choose whether to check it out immediately.
- **Switch**: click any branch.
- **Merge**: check out the target branch (for example `main`), right-click the branch to merge
  and choose **Merge into current branch**.
- **Delete**: right-click a branch and choose **Delete Branch**. You cannot delete the branch
  that is checked out.

Remote branches are listed under **Remote Branches**, where you can check out, fetch or delete
them.

Save your work before switching, merging or deleting branches. Git may reject a switch that would
overwrite changes: commit or stash them deliberately, or use a separate
[worktree](https://athas.dev/docs/git-worktrees). Review conflicts and the final diff after a merge.

## Diffs

Click a changed file in Source Control to open its diff. To see an older change, open the commit
history, click a commit, then click a file.

- **Inline** shows additions and deletions in one column, on green and red backgrounds.
- **Side by side** shows the original on the left and the modified file on the right.

Choose the default layout, and whether clicking a changed file opens the diff directly, under
**Settings > Git**.

A working-tree diff shows saved changes; a staged diff shows what the next commit includes.
Compare the right versions and check the active branch. A clean diff does not prove tests passed.

## Gutter and blame

In the editor, the gutter marks changed lines: green for added, red for deleted and yellow for
modified. Click a marker to see the original content.

Inline blame shows who last changed each line. Turn it on in **Settings > Git** or toggle it with
`Cmd/Ctrl+Shift+B`.
