Create a patch by comparing a specific branch on the remote with a specific local branch

Solution 1:

Use git format-patch origin/master. This creates a patch file for each commit on your checked out branch, which is not in origin/master.

To have one file instead of multiple files you can use

git format-patch master --stdout > mypatch.patch

Solution 2:

Use this to create one file containing all commits in your current branch that are not in the master branch:

git format-patch master --stdout > mypatch.patch