1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 22:42:08 +02:00
tldr/pages/common/git-am.md
Hugo Locurcio 401f0388c3
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.
2023-04-08 15:14:32 +05:30

21 lines
608 B
Markdown

# git am
> Apply patch files and create a commit. Useful when receiving commits via email.
> See also `git format-patch`, which can generate patch files.
> More information: <https://git-scm.com/docs/git-am>.
- Apply and commit changes following a local patch file:
`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:
`git am --abort`
- Apply as much of a patch file as possible, saving failed hunks to reject files:
`git am --reject {{path/to/file.patch}}`