[Git] Apply a patch created with git diff

Created on November 30, 2026

You can save the output of git diff and apply it to another working tree with git apply.

In the repository with the changes, write the unstaged changes to tracked files to some.patch.

git diff > some.patch

Make the patch file available in the target repository and run the following command from its root. The files there should still match the context in the patch.

git apply some.patch

The command applies the changes to the working tree without creating a commit.

Git