How to apply `git diff` patch without Git installed?

前端 未结 5 1660
轻奢々
轻奢々 2020-12-04 04:57

How can my client apply patch created by git diff without git installed? I have tried to use patch command but it always asks file name to patch.

5条回答
  •  我在风中等你
    2020-12-04 05:15

    Use

    git apply patchfile
    

    if possible.

    patch -p1 < patchfile 
    

    has potential side-effect.

    git apply also handles file adds, deletes, and renames if they're described in the git diff format, which patch won't do. Finally, git apply is an "apply all or abort all" model where either everything is applied or nothing is, whereas patch can partially apply patch files, leaving your working directory in a weird state.

提交回复
热议问题