Creating patches from branches

Instead of counting the number of commits you need to make patches for, you can create the patches by specifying the target branch when running the format-patch command.

Getting ready

We'll use the same repository as in the previous example:

$ git clone https://github.com/dvaske/offline-sharing.git
$ cd offline-sharing

Create the master branch locally without checking out:

$ git branch master origin/master

Make sure we have develop checked out:

$ git checkout develop

How to do it...

We'll pretend that we have been working on the develop branch and have made some commits. Now, we need to format patches for all these commits so we can send them to the repository maintainer or carry them to another machine.

Let's see the ...

Get Git: Mastering Version Control now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.