GitButler ⧓

Commands
>_

but merge

Merge a branch directly onto the target branch, bypassing review.

Merges the branch onto the configured target (for example origin/master) without going through a pull request — the "just push to the target" workflow. By default the target is fast-forwarded to the branch tip when possible (no merge commit); otherwise a merge commit is created, or with --ff-only the merge is refused. When the target branch has no upstream (for example in a repository without a remote), or for a local (gb-local) target, the refs are moved locally; otherwise the result is pushed to the remote. After merging, the remaining applied branches are reconciled onto the moved target, just like but pull.

Requires the GitButler workspace or, in single-branch mode, a checked-out branch. In single-branch mode, merging the checked-out branch checks out the target branch afterwards, like but pull does once a branch is merged upstream, or a generated branch when the target can't be reused; the output names the branch checked out. Updating a target that has an upstream is direct and not easily reversible, so a confirmation is required (use --yes to skip it in scripts). Merging into a target without an upstream publishes nothing, so it needs no confirmation and but undo reverts it.

When NOT to use this: if your project merges changes through pull requests / code review, use but push and open a PR (but pr new) instead — but merge deliberately bypasses that process. On a real remote, a branch protected against direct pushes will reject the merge.

Merging a segment with other segments below it is refused unless --whole-stack is passed with the stack's top segment, which merges the entire stack.

Examples

Merge a branch by its CLI ID:

but merge bu

Merge a branch by name, forcing a merge commit:

but merge my-feature-branch --no-ff

Merge a branch only if the target can be fast-forwarded to it:

but merge my-feature-branch --ff-only

Merge an entire stack by naming its top segment:

but merge top-branch --whole-stack

Usage: but merge <BRANCH> [OPTIONS]

Arguments

  • <BRANCH> — Branch ID or name to merge onto the target branch (required)

Options

  • --yes — Skip the confirmation prompt
  • --no-ff — Always create a merge commit, even when the branch can be fast-forwarded
  • --ff-only — Refuse to merge unless the target can be fast-forwarded to the branch tip
  • --whole-stack — Merge the entire stack: BRANCH must be the top segment, and the segments below it are published to the target along with it

Last updated on

On this page

Edit on GitHubGive us feedback