git apply
all
Apply a patch to files and/or to the index without creating a commit. See also: `git am`.
More info →Options (3)
-v, --verbosebooleanPrint messages about the patched files
Example:
git apply {{[-v|--verbose]}} {{path/to/file}}-L, --locationbooleanApply a remote patch file
Example:
curl {{[-L|--location]}} {{https://example.com/file.patch}} | git apply-R, --reversebooleanApply the patch in reverse
Example:
git apply {{[-R|--reverse]}} {{path/to/file}}Examples (6)
Print messages about the patched files
git apply [-v|--verbose] path/to/fileApply and add the patched files to the index
git apply --index path/to/fileOutput diffstat for the input and apply the patch
git apply --stat --apply path/to/fileApply the patch in reverse
git apply [-R|--reverse] path/to/fileStore the patch result in the index without modifying the working tree
git apply --cache path/to/filemade by @shridhargupta | data from tldr-pages