> ## Documentation Index
> Fetch the complete documentation index at: https://docs.termpad.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Review Changes

> Review, stage, commit, and push changes from your worktrees

After an AI completes work, you need to review the changes before committing. This guide walks through the full review and commit workflow.

## Prerequisites

* Git installed and configured

<Info>
  GitHub CLI (`gh`) is optional. It's only needed for:

  * Creating pull requests
  * Viewing PR status badges on branches
  * Browsing your GitHub repositories when cloning

  All core features (reviewing, staging, committing, pushing) work without it.
</Info>

## Viewing Changes

### Open the source control panel

<Steps>
  <Step title="Select a worktree">
    Click on the worktree you want to review.
  </Step>

  <Step title="View the source control panel">
    The source control panel shows on the side. It lists all files with changes.
  </Step>
</Steps>

<Tip>
  You can also open the diff viewer by clicking the eye icon in the source control header.
</Tip>

<Tip>
  Prefer reviewing in your own editor? Click the "Open in Editor" button in the top toolbar to open the worktree in VS Code, Cursor, or your configured editor. This is useful for manual changes or reviewing diffs in a familiar environment.
</Tip>

### Understanding file status

Files are marked with their status:

| Icon  | Status    | Meaning                  |
| ----- | --------- | ------------------------ |
| **M** | Modified  | File has changes         |
| **A** | Added     | New file created         |
| **D** | Deleted   | File removed             |
| **R** | Renamed   | File moved or renamed    |
| **U** | Untracked | New file not yet tracked |

### View a file diff

Click any file in the source control panel to see its diff:

* **Red lines**: Removed content
* **Green lines**: Added content
* **Gray lines**: Unchanged context

## Reviewing Changes

### What to look for

When reviewing AI-generated code, check for:

<AccordionGroup>
  <Accordion title="Correctness">
    * Does the code do what was asked?
    * Are there logic errors?
    * Are edge cases handled?
  </Accordion>

  <Accordion title="Security">
    * Any hardcoded credentials?
    * Input validation present?
    * SQL injection possible?
    * XSS vulnerabilities?
  </Accordion>

  <Accordion title="Quality">
    * Does it match your code style?
    * Is it readable?
    * Are names descriptive?
  </Accordion>

  <Accordion title="Completeness">
    * Are tests included?
    * Is error handling present?
    * Documentation updated?
  </Accordion>
</AccordionGroup>

### Adding inline comments

<Steps>
  <Step title="Click on a line">
    Click the line number where you want to comment. For multi-line comments, click a line number, hold, and drag to select multiple lines.
  </Step>

  <Step title="Write your comment">
    Describe what needs to change.
  </Step>

  <Step title="Copy to AI">
    Click the copy button in the header to automatically copy all comments and paste them into your AI chat. Alternatively, click the export button and feed that to the AI.
  </Step>
</Steps>

<Tip>
  Instead of fixing issues yourself, send them back to the AI. Describe what's wrong and let the AI iterate.
</Tip>

## Staging Changes

Once you're satisfied with the changes, stage them for commit.

### Stage all changes

Click **Stage All** to stage everything at once.

### Stage individual files

<Steps>
  <Step title="Find the file">
    Locate the file in the source control panel.
  </Step>

  <Step title="Stage it">
    Click the **+** icon next to the file.
  </Step>
</Steps>

### Unstage files

If you staged something by mistake:

<Steps>
  <Step title="Find the staged file">
    Look in the "Staged Changes" section.
  </Step>

  <Step title="Unstage it">
    Click the **-** icon.
  </Step>
</Steps>

## Discarding Changes

If you don't want to keep the changes:

### Discard all changes

<Steps>
  <Step title="Click Discard All">
    In the source control panel, click **Discard All**.
  </Step>

  <Step title="Confirm">
    Confirm you want to discard. This cannot be undone.
  </Step>
</Steps>

### Discard specific files

<Steps>
  <Step title="Find the file">
    Locate the file in the source control panel.
  </Step>

  <Step title="Discard it">
    Click the discard icon next to the file.
  </Step>
</Steps>

<Warning>
  Discarding changes permanently deletes uncommitted work. Make sure you don't need it before discarding.
</Warning>

## Committing Changes

<Steps>
  <Step title="Stage your changes">
    Make sure all files you want to commit are staged.
  </Step>

  <Step title="Write a commit message">
    Enter a clear, descriptive commit message:

    ```
    Add user authentication with JWT

    - Implement login and register endpoints
    - Add JWT token generation and validation
    - Create auth middleware for protected routes
    - Add tests for auth flows
    ```
  </Step>

  <Step title="Click Commit">
    Click the **Commit** button to create the commit.
  </Step>
</Steps>

<Tip>
  You can also ask your AI to commit the changes for you. It will review the changes and create an appropriate commit message.
</Tip>

## Pushing Changes

After committing, push to the remote:

<Steps>
  <Step title="Click Push">
    Click the arrow up icon in the toolbar.
  </Step>
</Steps>

## Creating a Pull Request

<Steps>
  <Step title="Click Create PR">
    Click the Create PR icon in the toolbar (beside the push button).
  </Step>

  <Step title="Fill in PR details">
    Termpad opens your browser to the PR creation page. Fill in:

    * Title
    * Description
    * Reviewers
    * Labels
  </Step>
</Steps>

<Info>
  Creating PRs requires the GitHub CLI (`gh`) to be installed and authenticated.
</Info>

## Tips

### Review frequently

Don't let changes pile up. Review after each significant AI task:

1. AI completes a piece of work
2. Review immediately
3. Commit if good, or send back for fixes
4. Continue

### Use atomic commits

Make each commit a logical unit of work:

* One feature per commit
* One bug fix per commit
* Don't mix unrelated changes
