# Git Workflow

import { Callout } from "nextra/components"

<GitActions />

The everyday git actions have keyboard shortcuts. Pane shows you the command it will run before it runs it. No surprises.

## Core actions

**Commit** stages all changes in the pane's worktree and opens a message dialog. Write your message and confirm to create the commit. **Push** sends the branch to remote. **Rebase** pulls the latest from main into your branch, keeping your history clean. **Merge** opens a **Merge to main** dialog where **Squash commits into one** is on by default. **Merge & Archive** merges and then archives the pane in one step.

<Callout type="info">
  Rebase before merge. This ensures your changes sit on top of the latest main and the squash commit applies cleanly.
</Callout>

<Toggle title="Button-only actions: Fetch, Stash, Pop Stash">
**Fetch** updates remote tracking refs without modifying your branch. No keyboard shortcut — click the button in the git toolbar.

**Stash** saves all uncommitted changes to the git stash and clears the working tree. **Pop Stash** restores the most recent stash. Both are click-only and useful when you need a clean slate temporarily.
</Toggle>

<Toggle title="Undo commit">
The undo commit action runs `git reset --soft HEAD~1`, moving the last commit back to staging. Your changes are preserved — only the commit is unwound. Use this to amend a message or split changes before re-committing.
</Toggle>

<Toggle title="Commit attribution">
You stay the author. Commits use your global git identity (`user.name` and `user.email`).

Pane adds two small things by default. Both are on in **Settings → Worktrees & Git**, and you can switch either one off:

1. **Attribute commits to Pane.** Pane sets the committer to `Pane <runpane@users.noreply.github.com>` for commits made from Pane terminals and agents. GitHub shows "committed by Pane" next to your name.
2. **Include Pane footer in commits.** When you commit with Pane's commit action, Pane adds a `Co-Authored-By: Pane` line to the message.

If you use a custom system prompt or agent configuration that appends a footer to commit messages, that footer appears in the commit body, not the subject line.
</Toggle>

<Toggle title="When actions are disabled">
Git actions are disabled while a pane is in the **running** or **initializing** state. This prevents conflicts between an active agent and a concurrent git operation on the same worktree. Wait for the agent to finish, or stop it manually before committing or pushing.
</Toggle>
