Skip to main content

Committing Changes with AI

Tower can use AI to generate and rephrase commit messages based on your staged changes.

Committing Changes with AI in Tower

Prerequisites

AI Commits requires a locally installed AI command-line tool. Tower currently supports three providers:

  • Claude Code — Anthropic's CLI tool for Claude
  • OpenAI Codex — OpenAI's CLI tool
  • Gemini CLI — Google's CLI tool for Gemini

You must install at least one of these before enabling the feature in Tower. There's no API key to add in Tower: the CLI tool uses the account you log in with.

Installing the CLI Tools

Install the CLI tools from Tower's terminal: open a repository in Tower, choose File > Open in Terminal, and run the installation command there. The commands below use npm, which comes with Node.js.

For Claude Code:

npm install -g @anthropic-ai/claude-code

For OpenAI Codex:

npm install -g @openai/codex

For Gemini CLI:

npm install -g @google/gemini-cli

After installation, run claude (or codex, or gemini) in the same terminal and follow the prompts to log in to your Anthropic, OpenAI, or Google account. Tower detects newly installed CLI tools automatically, even while it's running, so there's no need to restart it.

For other installation methods, refer to the Claude Code, OpenAI Codex, and Gemini CLI documentation.

Verify your CLI is accessible
The CLI tool must be accessible from your system's PATH. You can verify this by running claude --version, codex --version, or gemini --version in Tower's terminal. If Tower can't find the CLI tool of the selected provider, a warning icon appears in Preferences > AI.

A warning in the AI preferences when the Claude Code CLI can't be found
A warning when Tower can't find the CLI tool

Generating a Commit Message

With changes staged in your working copy, click the ✨ Generate button. Tower passes your staged diff to the selected CLI tool, which returns a generated commit subject and description. The commit composer fields are populated automatically — you can review and edit the result before committing.

Stage your changes first
By default, the "✨ Generate" button works with staged changes only. Make sure the files or hunks you want reflected in the commit message are staged before generating, or choose "Include Unstaged Changes" from the button's dropdown menu.

The Generate Menu

A dropdown arrow next to the ✨ Generate button opens a menu with more options:

  • Generate Commit Message generates a message with your default prompt.
  • Rephrase Commit Message rewrites the subject and description you've already written.
  • Generate with "…" generates a message with one of your prompt presets, for example a concise one-liner versus a detailed description.
  • Include Unstaged Changes lets the AI look at your unstaged changes, too.
  • AI Settings… opens Preferences > AI.
The Generate button's menu in Tower
The Generate button's menu in Tower

Configuring AI Commits

To configure AI Commits, open Preferences > AI. Here you can:

  • Turn Enable AI agent support on or off, and select the provider: Claude Code, Codex, or Gemini.
  • Choose whether the commit view shows its AI setup button (Show setup button in commit view).
  • Manage your prompt presets.
The AI tab in Tower's Preferences
The AI tab in Tower's Preferences

Managing Custom Prompts

You can define your own prompt presets in Preferences > AI. Custom prompts are useful for teams that follow specific commit conventions or formatting rules.

To add a custom prompt:

  1. Open Preferences > AI.
  2. Click the + button below the list of prompts.
  3. Enter a title and the prompt text. Tick Is Global Default to use it in all your repositories.
  4. Click Save.

Your custom prompts will appear alongside the built-in presets in the dropdown menu. To change a prompt, select it and click Edit; Set as Default makes it the global default, and the - button deletes it.

Adding a New Custom Prompt
Adding a New Custom Prompt

Need a different style for a specific project? You can choose a prompt per repository in its Repository Settings, or pick one from the ✨ Generate button's menu whenever you need it.

Prompt Examples

Here are a few examples to get you started:

Conventional Commits

"Write a commit message following the Conventional Commits specification. Use the format type(scope): description. Choose the appropriate type (feat, fix, refactor, chore, docs, style, test, perf, ci, build). Include a body paragraph explaining the motivation and what changed if the diff is non-trivial."

Gitmoji

"Write a commit message for the following changes using the gitmoji convention. Start the subject line with the most appropriate gitmoji (e.g. ✨ for a new feature, 🐛 for a bug fix, ♻️ for refactoring). Keep the subject under 72 characters."

Short & Direct

"Summarize the following code changes in a single short commit message (under 72 characters). Be direct and describe what changed, not why."

Looking for more? Our free Git Commit Templates Library has ready-made templates for Conventional Commits, Gitmoji, and more.

Disabling AI Commits

To disable all AI functionality: open Preferences > AI and untick Enable AI agent support. This fully disables the feature — the ✨ Generate button will no longer appear, and no data will be sent to any AI tool.

Privacy and Data Handling

Tower itself does not operate any AI service and does not send any of your code or data to Tower's servers.

When you click ✨ Generate, Tower sends your staged diff to the locally installed CLI tool on your machine. That tool communicates directly with the AI provider (Anthropic, OpenAI, or Google) using the credentials you set up during CLI installation. Your data is subject to the privacy policy of the provider whose CLI you have installed, not Tower's.