Git Integration

Stage, commit, push, and create PRs—all optimized for mobile.

AgentOS includes a complete git workflow so you never need to leave the app. Every feature works on mobile with touch-optimized controls.

Git Panel

Open the git panel from the pane header tabs. It shows three sections:

  • Staged - Files ready to commit
  • Unstaged - Modified files not yet staged
  • Untracked - New files not in git

The panel auto-refreshes when files change, or tap the refresh button to update manually.

Staging Files

Tap to Stage

Click the + button next to any file to stage it. Click to unstage.

Swipe to Stage (Mobile)

On touch devices, swipe gestures make staging fast:

  • Swipe right on an unstaged file to stage it
  • Swipe left on a staged file to unstage it

Stage All

Click Stage All to stage all modified and untracked files at once.

Viewing Diffs

Tap any file to see its diff:

Unified View

Diffs display in unified format—perfect for narrow mobile screens:

- const oldValue = 42;
+ const newValue = 100;

Features

  • Syntax highlighting - Color-coded by language
  • Line numbers - Reference specific changes
  • Context lines - See surrounding code
  • Addition/deletion highlighting - Green for additions, red for removals

Merge Commits

AgentOS handles merge commits correctly, showing changes from both parents.

Committing

Once you've staged files:

  1. Enter a commit message in the text field
  2. Click Commit

Validation

The commit button is disabled if:

  • No files are staged
  • Commit message is empty

Amend

To modify the last commit, check Amend before committing. This replaces the previous commit instead of creating a new one.

Pushing

After committing, click Push to push to the remote.

New Branches

If you're on a new branch without a remote tracking branch, AgentOS sets up tracking automatically with --set-upstream.

Push Status

The UI shows when you have unpushed commits and how many.

Commit History

View recent commits in the History tab:

  • Last 30 commits displayed
  • Commit hash (abbreviated)
  • Message and author
  • Timestamp
  • Files changed count

Viewing Historical Diffs

Click any commit to see:

  1. List of files changed in that commit
  2. Tap a file to see its diff at that point

This is great for reviewing what your AI agent changed.

Creating Pull Requests

AgentOS integrates with GitHub CLI (gh) for PR creation:

  1. Click session menu (⋮)
  2. Select Create PR
  3. Enter title and description
  4. Click Create

The PR is created and you get a link to view it on GitHub.

Requirements

  • GitHub CLI (gh) installed and authenticated
  • Remote repository on GitHub
  • You're on a feature branch (not main/master)

Worktree PRs

For worktree sessions, the Create PR button appears automatically since each worktree has its own branch.

Git Worktrees

Worktrees let you work on multiple features in parallel, each with its own branch and directory.

Creating a Worktree Session

  1. Click + New Session
  2. Enable Create Worktree
  3. Enter a feature name (e.g., "auth-module")
  4. AgentOS creates:
    • Branch: feature/auth-module
    • Directory: ~/.agent-os/worktrees/{project}-auth-module
    • Copies .env* files from main repo
    • Runs package manager install

Worktree Ports

Each worktree gets a unique dev server port:

WorktreePort
First3100
Second3110
Third3120
...+10 each

This prevents port conflicts when running multiple dev servers.

Worktree Configuration

Customize setup with .agent-os.json in your repo:

{
  "setup": [
    "cp $ROOT_WORKTREE_PATH/.env.local .env.local",
    "pnpm install",
    "npm run db:migrate"
  ],
  "devServer": {
    "command": "npm run dev",
    "portEnvVar": "PORT"
  }
}

Variables available:

  • $ROOT_WORKTREE_PATH - Path to the main repository
  • $WORKTREE_PATH - Path to this worktree
  • $PORT - Assigned port number

Worktree Cleanup

When you delete a worktree session, AgentOS offers to:

  • Delete the worktree directory
  • Delete the feature branch

Or you can keep them for later.

Mobile Git Workflow

A typical mobile git workflow:

  1. Review changes - Open git panel, see what's modified
  2. Check diffs - Tap files to see exactly what changed
  3. Stage selectively - Swipe to stage files you want
  4. Commit - Enter message and commit
  5. Push - Send to remote
  6. Create PR - Open a pull request from the menu

All without leaving AgentOS or needing a desktop.

Tips

Commit Often

Your AI agent makes many small changes. Commit frequently to:

  • Create restore points
  • Keep history granular
  • Make PRs easier to review

Use Worktrees for Features

Instead of one long session, create worktree sessions for each feature. Benefits:

  • Isolated branches
  • Clean git history
  • Easy to create PRs
  • Can work on multiple features in parallel

Review Before Pushing

Always check the diff before pushing. AI agents occasionally make unexpected changes. The git panel makes reviewing fast and easy.