Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

merge / rebase / squash / verify

gwt merge

Full merge pipeline: verify, rebase, squash, merge, and cleanup.

gwt merge [target] [--keep]

Options

OptionDescription
targetBranch to merge into (default: auto-detect upstream)
--keepKeep worktree and branch after merge

Pipeline steps

  1. Verify — runs pre-merge hooks
  2. Rebase — rebases current branch onto target
  3. Squash — combines all commits into one (see below)
  4. Merge — fast-forward merges into target
  5. Post-merge hooks — runs post-merge hooks (non-blocking)
  6. Cleanup — removes worktree and branch (unless --keep)

If you’re already on the target branch, the command errors out — switch to a feature branch first.


gwt verify

Run pre-merge hooks to check if the branch is ready to merge.

gwt verify

This is a shortcut for dispatching the pre-merge hook event. Configure what runs in [hooks.pre-merge].


gwt rebase

Rebase the current branch onto a target.

gwt rebase [target]

Options

OptionDescription
targetBranch to rebase onto (default: auto-detect upstream)

gwt squash

Squash all commits on the current branch into one.

gwt squash [target]

Options

OptionDescription
targetBranch for merge-base calculation (default: auto-detect)

AI commit messages

If merge.commit-message-command is configured, gwt passes the squash diff to the configured command and presents the generated message:

Generated commit message:

  feat: add user authentication with OAuth2 support

Use this message? [Y/n/edit]
  • Y (default) — use the generated message
  • n — enter a message manually
  • edit — open the message in $EDITOR

If the command fails, falls back to manual input.

Configuration

[merge]
commit-message-command = "your-ai-tool summarize-commits"