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

# Git Panel

> Push, pull, and manage branches from the editor's built-in Git panel

<Info>
  This page covers the Git panel inside the code editor. For the full GitHub connection setup, see [GitHub Integration](/integrations/github).
</Info>

Connect your Hiveku project to a GitHub repository to version-control your code. The integration is optional -- you can use Hiveku with or without GitHub.

## Connecting to GitHub

<Steps>
  <Step title="Authorize GitHub">
    Go to **Settings > Integrations > GitHub** and click **Connect**. Authorize Hiveku to access your GitHub account.
  </Step>

  <Step title="Select or create a repository">
    Choose an existing repository from the dropdown, or create a new one directly from Hiveku.
  </Step>

  <Step title="Export your files">
    Hiveku pushes your current project files to the selected repository. This initial export creates the first commit.
  </Step>
</Steps>

## Committing changes

When GitHub is connected, Hiveku treats GitHub as the source of truth for your project. There are three commit paths:

* **Manual** -- click the **Commit** button in the GitHub panel, write a commit message, and confirm
* **AI session end (automatic)** -- when an AI chat session finishes, any files the AI edited are batched into a single bot commit and pushed to your dev branch. This happens \~10 seconds after the AI finishes responding so consecutive turns combine into one commit
* **From your laptop** -- run `git commit && git push` from your local checkout. Hiveku's webhook handler picks up your push and reconciles the database against the new commit

<Warning>
  If you edit a file in Hiveku and also in your local checkout before either side commits, both versions can diverge from the recorded baseline. The next sync will refuse with a conflict notice so neither version is silently lost -- you'll resolve it by picking which version wins. See [Resolving conflicts](#resolving-conflicts) below.
</Warning>

## Pulling changes

Click **Pull** to fetch the latest changes from the remote repository and update your project files.

<Warning>
  Pulling overwrites your local project files with the remote versions. Make sure you've committed or saved any work you want to keep before pulling.
</Warning>

## Branch management

| Action            | How to                                                                               |
| ----------------- | ------------------------------------------------------------------------------------ |
| **Create branch** | Click the branch dropdown and select **New Branch**. Enter a name and confirm.       |
| **Switch branch** | Select a different branch from the dropdown. Your project files update to match.     |
| **Merge branch**  | Select the target branch, then click **Merge**. Resolve any conflicts in the editor. |
| **Delete branch** | Click the trash icon next to a branch in the dropdown.                               |

## Auto-commit at AI session end

When your project is connected to GitHub, auto-commit is always on for AI sessions -- there is no toggle to enable or disable it. Every chat turn that edits files ends with a single bot commit pushed to your dev branch.

How it works:

* The AI edits files during the chat session and saves them to Hiveku's database
* When the streaming response finishes, a 10-second debounce timer starts
* If no follow-up turn arrives in that window, Hiveku batches every file the session touched into one commit, signed by `hiveku[bot]`
* The commit message is prefixed `[hiveku] Sync from Hiveku` so it can be identified in your repo history
* If a follow-up turn does arrive within the window, the timer resets so back-to-back turns combine into one commit instead of spamming N commits

This means GitHub always reflects your latest AI work shortly after the session ends -- nothing important sits only in Hiveku's database.

<Info>
  Auto-commit and auto-deploy are independent. Bot commits never trigger an auto-deploy, even if you have auto-deploy enabled on the target branch. Auto-deploy only fires for commits made by you (or external collaborators) from outside Hiveku. See [Auto-deploy on push](/integrations/github#auto-deploy-on-push).
</Info>

## Resolving conflicts

Both Hiveku and an external git client can edit the same file before either side commits. When that happens, the next sync (triggered automatically by a deploy or webhook) detects the divergence and refuses to overwrite either side. Instead, Hiveku surfaces the conflicting files so you can resolve them.

You have three resolution paths per file:

| Choice                  | What it does                                                               |
| ----------------------- | -------------------------------------------------------------------------- |
| Keep the Hiveku version | Push the Hiveku version up to GitHub. The external change is overwritten.  |
| Keep the GitHub version | Pull the GitHub version into Hiveku. Your Hiveku-side edits are discarded. |
| Merge manually          | Open the file, combine both versions by hand, then save and commit.        |

Once every conflict is resolved, retry the deploy or sync and it will proceed normally.

## Viewing commit history

Click the **History** tab in the GitHub panel to see a list of all commits. Each entry shows the commit message, author, timestamp, and changed files.

## Pull requests

You can create and view pull requests from the GitHub panel. Click **New PR** to open a pull request against the base branch, or browse existing PRs to review and merge.

## Disconnecting

Go to **Settings > Integrations > GitHub** and click **Disconnect**. This removes the link between your Hiveku project and the GitHub repository. Your project files and the GitHub repository both remain intact.
