git-am, git-apply: add and tweak remote patch examples (#10019)

`curl` now uses the `-L` option to follow redirects, which is required
when applying patch files from GitHub URLs. The example was also added
to `git-am` where it works too.

The difference between `git-am` and `git-apply` was also clarified in each
command's description.
pull/23/head
Hugo Locurcio 2023-04-08 11:44:32 +02:00 committed by GitHub
parent 3e3230b8c3
commit 401f0388c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -1,13 +1,17 @@
# git am # git am
> Apply patch files. Useful when receiving commits via email. > Apply patch files and create a commit. Useful when receiving commits via email.
> See also `git format-patch`, which can generate patch files. > See also `git format-patch`, which can generate patch files.
> More information: <https://git-scm.com/docs/git-am>. > More information: <https://git-scm.com/docs/git-am>.
- Apply a patch file: - Apply and commit changes following a local patch file:
`git am {{path/to/file.patch}}` `git am {{path/to/file.patch}}`
- Apply and commit changes following a remote patch file:
`curl -L {{https://example.com/file.patch}} | git apply`
- Abort the process of applying a patch file: - Abort the process of applying a patch file:
`git am --abort` `git am --abort`

View File

@ -1,6 +1,7 @@
# git apply # git apply
> Apply a patch to files and/or to the index. > Apply a patch to files and/or to the index without creating a commit.
> See also `git am`, which applies a patch and also creates a commit.
> More information: <https://git-scm.com/docs/git-apply>. > More information: <https://git-scm.com/docs/git-apply>.
- Print messages about the patched files: - Print messages about the patched files:
@ -13,7 +14,7 @@
- Apply a remote patch file: - Apply a remote patch file:
`curl {{https://example.com/file.patch}} | git apply` `curl -L {{https://example.com/file.patch}} | git apply`
- Output diffstat for the input and apply the patch: - Output diffstat for the input and apply the patch: