Pagine

Monday 22 May 2017

How to create a patch with git

When a developer to make small fixes in a part of the project, but he didn't want to give him access to the repository. In this scenario the developer can create a git patch and send it via mail.
The following command will create .patch files per commit:
$ git format-patch origin patch-myproject.patch
Later you can send the patch by mail:
$ git send-email patch-myproject.patch
The patch can be imported with by executing this:
$ git apply /tmp/patch-myproject.patch
This command will apply the patch, but it doesn't create commits. So, to generate a series of commits, use the git am command:
$ git am /tmp/patch-myproject.patch

No comments:

Post a Comment