Creating patches
In this recipe, we'll learn how to make patches out of commits. Patches can be sent via email for quick sharing or can be copied to sneakernet devices (USB sticks, memory cards, external hard disk drives, and so on) if they need to be applied to an offline computer or suchlike. Patches can be useful methods to review code, as the reviewer can apply a patch to their repository, investigate the difference, and check the program. If the reviewer decides that the patch is good, they can publish (push
) it to a public repository, given that the reviewer is the maintainer of the repository. If the reviewer rejects the patch, they can simply reset their branch to the original state and inform the author of the patch that more work is needed before it can be accepted.
Getting ready
In this example, we'll clone and use a new repository. The repository is just an example repository for Git commands and only contains some example commits:
$ git clone https://github.com/PacktPublishing...