| [ << Working with source code ] | [Top][Contents][Index][ ? ] | [ Compiling >> ] | ||
| [ < Git log ] | [ Up : Advanced Git procedures ] | [ Sending and receiving patches via email > ] | ||
3.4.7 Applying remote patches
TODO: Explain how to determine if a patch was created with
git format-patch.
Well-formed git patches created with git format-patch
should be committed with the following command:
git am patch
Patches created without git format-patch can be
applied in two steps. The first step is to apply the patch to the
working tree and the index:
git apply --index patch
The second step is to commit the changes and give credit to the author of the patch. This can be done with the following command:
git commit --author="John Smith <john@example.com>"
Please note that using the --index option for patching is quite
important here and cannot reliably be replaced by using the
-a option when committing: that would only commit files from the
working tree that are already registered with git, so every file that
the patch actually adds, like a regtest for a fixed bug, would
get lost. For the same reason, you should not use the git-independent
‘patch’ program for applying patches.
| [ << Working with source code ] | [Top][Contents][Index][ ? ] | [ Compiling >> ] | ||
| [ < Git log ] | [ Up : Advanced Git procedures ] | [ Sending and receiving patches via email > ] | ||