Git cannot-do-a-partial-commit-during-a-merge Committing selected paths was refused because a merge must be recorded as one unit.

dev@local: ~/project — git
dev@local~/project$git commit -- src/app.ts
error: cannot do a partial commit during a merge
Diagnostics Translation
Committing selected paths was refused because a merge must be recorded as one unit.
waiting for resolution...
LowVersion Control System

Reviewed for reference consistency: August 11, 2026

Code is Safe

SECURE

Git has paused the operation to protect your code. No data has been lost or corrupted.

What To Know

A merge is waiting to be recorded, and only a whole-tree commit is accepted until that record exists — never a path-scoped subset.

Where Did It Fail?

Working Tree
Your local files
add
Staging Index
Prepared changes
commit
Local Repo
Commit history
push/fetch
Remote Server
GitHub/GitLab
The operation was blocked at the staging area. Git cannot prepare or finalize the commit.

Commands That Trigger This

$git commit -- src/app.ts
Running while a merge is still in progress
An editor or tool wrapping commit with explicit path arguments during a conflicted merge
Trying to commit a quick fix to one file before finishing the merge commit

Technical Background

01

A merge commit has one job: record the exact intersection of two histories. If paths could be committed selectively, the recorded merge would describe a tree that neither parent branch produced, and the deferred half of the index would be stranded without a merge commit to belong to.

02

The refusal fires before conflict resolution is even considered — the same error appears with a clean tree and with unmerged files. Committing the whole merge (`git commit` with no paths) or aborting the merge are the two exits Git leaves open.

Underlying Causes

MERGE_HEAD exists because a merge (or pull) was started and not yet committed
The commit command included a pathspec, which selects the partial-commit mode
A wrapper script adds file arguments to every commit invocation
Habits from normal development, where path-scoped commits are routine, carried over into the merge state

Frequently Asked Questions

Outside a merge, committing one path defers the rest of the index safely; inside a merge, the deferred half could never be committed later without inventing a second merge commit.

Yes — the full merge commit comes first, and ordinary path-scoped commits follow as usual once it exists.

Related Git States