Development using git:Creating patches

From Alpine Linux

There are several possible ways to send patches. Below the most common are described.

Only the last commit with 'git send-email'

To submit the last commit as a patch to alpine-devel mailing list:

git send-email --to alpine-devel@lists.alpinelinux.org HEAD^

The first line in commit message will be subject and the long description (separated with empty line) will be the body in the email. The example below shows

Initial APKBUILD file of packagename  <- Subject line

Enter some details about your package <- Mail body
here if you like. 
Note: The git send-email command is provided by the git-perl package.

if it fails, try to install postfix to have a sendmail binary (default shipped is busybox's).

Multiple commits with 'git send-email'

If you have many commits you can create a directory with patches and send them with git send-email.

rm -Rf patches mkdir patches git format-patch -o patches origin git send-email --to alpine-devel@lists.alpinelinux.org patches

If you have multiple patch consider using:

git send-email --compose --no-chain-reply-to --to alpine-devel@lists.alpinelinux.org patches

This will produce the patches for each local commit in the directory "patches" and send them. Use --no-chain-reply-to make sure it doesn't reply.

Don't do:

  • [PATCH 0/m]
    • [PATCH 1/m]
      • [PATCH 2/m]
        • ...

But do:

  • [PATCH 0/m]
    • [PATCH 1/m]
    • [PATCH 2/m]
    • ..

Multiple patches with 'email'

git format-patch -1

Where -1 sets how many commits you want to go back (mostly this is 1). This should create a patch called 0001......patch.

An easy way to send this patch to the list is with an program called 'email'.

apk add email

to send to the mailing list you would do:

email -a 0001...patch alpine-devel@lists.alpinelinux.org

And provide a subject and body after you execute the above cmd.