Skip to content

git worktree-merge

Merge branches across worktrees

TIP

This command is also available as daft merge. See daft merge.

Description

Merges one or more source branches into a target worktree's branch.

When --into is omitted, the target is the current worktree's branch, mirroring git merge. When --into <target> is supplied, the merge is performed against that worktree's branch from wherever you are.

Multiple sources invoke git's octopus strategy, announced explicitly.

Finish commands (--abort, --continue, --quit) take an optional positional <worktree|branch>; default to the current worktree's branch.

Usage

git worktree-merge [OPTIONS] [SOURCE_OR_TARGET]

Arguments

ArgumentDescriptionRequired
<SOURCE_OR_TARGET>Source branches/commits to merge (start mode), OR optional target worktree/branch for --abort / --continue / --quit (finish mode; max one positional)No

Options

OptionDescriptionDefault
--into <TARGET>Target worktree/branch. Defaults to the current worktree's branch
--abortAbort an in-progress merge in the named worktree (defaults to CWD)
--continueContinue an in-progress merge in the named worktree (defaults to CWD)
--quitQuit an in-progress merge without resetting the index (defaults to CWD)
-m <MSG>Commit message for the merge commit (mirrors git merge -m)
-F, --file <FILE>Read the commit message from FILE (mirrors git merge -F)
--editLaunch the editor to edit the merge commit message
--no-editAccept the auto-generated merge commit message without editing
--cleanup <MODE>Message cleanup mode (mirrors git merge --cleanup)
--mergeExplicit merge style — always create a merge commit. This is the default; the flag exists for canceling a config-set default style
--squashSquash style — collapse source's commits into one squashed commit on target
--rebaseRebase style — rebase source onto target, then fast-forward (linear, preserves commits)
--rebase-mergeRebase-merge style — rebase source onto target, then create a merge commit
--commitAutomatically create the merge commit after a successful merge
--no-commitLeave the merge staged without committing
--signoffAdd a Signed-off-by trailer to the merge commit
--no-signoffExplicitly disable signoff (cancel a config default)
-s, --strategy <STRAT>Merge strategy to use (e.g. ours, recursive, octopus)
-X, --strategy-option <OPT>Strategy-specific option (repeatable; mirrors git merge -X)
-S, --gpg-sign <KEYID>GPG-sign the merge commit. Accepts an optional KEYID; omit to use the default key
--no-gpg-signDo not GPG-sign the merge commit (cancels commit.gpgsign config)
--verify-signaturesVerify that the tip commit of the source is signed with a valid key
--no-verify-signaturesDo not verify signatures on the source tip commit
--allow-unrelated-historiesAllow merging histories that share no common ancestor
--statShow a diffstat at the end of the merge
-n, --no-statSuppress the diffstat at the end of the merge
--adopt-targetWhen the target has no worktree and the merge is not a pure fast-forward, create an ephemeral worktree to perform the merge without prompting
--no-adopt-targetWhen the target has no worktree and the merge is not a pure fast-forward, refuse without prompting
-y, --yesAuto-accept interactive prompts. Implies --adopt-target when neither --adopt-target nor --no-adopt-target is supplied. Future-proofs any new prompts we add
-r, --remove-branchRemove the source worktree and delete the source branch. The local/remote behavior follows branch.deleteRemote (defaults to local-only)
--keep-branchExplicit keep — for canceling a config-set merge.cleanup = remove-branch
--set-defaultWrite the resolved style/cleanup choices to git config --local after the merge succeeds
-v, --verboseBe verbose; show detailed progress

Global Options

OptionDescription
-h, --helpPrint help information
-V, --versionPrint version information

See Also

Released under MIT or Apache-2.0.