dev@local: ~/project — git
dev@local~/project$.patch
error: patch failed
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Diagnostics Translation
Git could not apply a patch file because the target code has changed too much.
waiting for resolution...
MediumVersion Control System

Reviewed for reference consistency: April 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

This means a patch-style change description no longer matches the code context it was designed for, so Git cannot place it cleanly.

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
Git halted to protect the uncommitted files in your active working directory.

Commands That Trigger This

$.patch
Emailing a file to a coworker, but they try to apply it a month later
$Applying a patch generated on a Windows machine to a Linux machine with different CRLF endings
Applying a patch generated on a Windows machine to a Linux machine with different CRLF endings

Technical Background

01

Patches are very rigid. They expect the file to look exactly as it did when the patch was created.

02

Unlike a robust three-way merge, a simple patch application doesn't have common history to fall back on, making it very sensitive to whitespace or minor edits.

Underlying Causes

Applying a patch generated from an old commit to a heavily modified file
Line endings (CRLF vs LF) mismatching between the patch and the local file
Another developer already fixed the bug the patch addresses

Frequently Asked Questions

It usually implies the patch still describes a real historical change, but the surrounding code no longer matches closely enough for Git to place it automatically.

Related Git States