How do patches work in Git?

后端 未结 6 1345
遥遥无期
遥遥无期 2020-12-23 12:02

I\'m new to Git, but familiar with SVN. As a test I made a repository in a local directory with git init. Then I cloned the empty repository (over SSH using 127

6条回答
  •  佛祖请我去吃肉
    2020-12-23 12:40

    Using GitHub patch

    1. Add .patch to a commit URL to get the patch file, example

      github.com/git/git/commit/b6b3b6a.patch

    2. Patch the original file like this:

      git am /tmp/b6b3b6a.patch
      

    Using GitHub diff

    1. Add .diff to a commit URL to get the patch file, example

      github.com/git/git/commit/b6b3b6a.diff

    2. Patch the original file like this:

      git apply -p0 /tmp/b6b3b6a.diff
      

    §5.3 Distributed Git - Maintaining a Project

提交回复
热议问题