Create patch or diff file from git repository and apply it to another different git repository

前端 未结 4 1578
青春惊慌失措
青春惊慌失措 2020-12-12 09:33

I work on WordPress based project and I want to patch my project at each new release version of WP. For this, I want generate a patch between two commits or tags.

For

4条回答
  •  伪装坚强ぢ
    2020-12-12 10:02

    To produce patch for several commits, you should use format-patch git command, e.g.

    git format-patch -k --stdout R1..R2
    

    This will export your commits into patch file in mailbox format.

    To generate patch for the last commit, run:

    git format-patch -k --stdout HEAD^
    

    Then in another repository apply the patch by am git command, e.g.

    git am -3 -k file.patch
    

    See: man git-format-patch and git-am.

提交回复
热议问题