How do patches work in Git?

后端 未结 6 1307
遥遥无期
遥遥无期 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:42

    You have to go to "repository 2", the one you want to create the patch from, and run git-format-patch to create the patch : git format-patch master --stdout > name_of_patch_file

    Then you go in "repository 1", the one you want to apply the patch to : git apply name_of_patch_file

    Sometimes it is useful to just check if the patch will cause problems : git apply --check name_of_patch_file

提交回复
热议问题