<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ph1lter</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ph1lter"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Ph1lter"/>
	<updated>2026-04-25T23:46:55Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Creating_patches&amp;diff=22306</id>
		<title>Creating patches</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Creating_patches&amp;diff=22306"/>
		<updated>2022-09-12T10:56:09Z</updated>

		<summary type="html">&lt;p&gt;Ph1lter: highlight how to update an old gitlab fork&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;New aports should normally go into testing repository. After a reasonable testing period if the package is complete (e.g. it has an init script, it has a working and sane default configuration, etc.) and it has a maintainer it can be moved into community repository. Main repository is for packages that are either core of the linux system or are dependencies of other core packages. A package in main cannot have a dependency in community or testing and a package in community cannot have a dependency on packages in testing.&lt;br /&gt;
&lt;br /&gt;
There are currently two ways to contribute to propose changes, via Gitlab and via the mailing list.&lt;br /&gt;
&lt;br /&gt;
== Submitting patches via Gitlab ==&lt;br /&gt;
&lt;br /&gt;
=== Setup ===&lt;br /&gt;
&lt;br /&gt;
To submit patches on [https://gitlab.alpinelinux.org Alpine Linux&#039; Gitlab instance] you first have to create an account for it [https://gitlab.alpinelinux.org/users/sign_in here]. It&#039;s recommended to set a SSH key now, refer to the [https://docs.gitlab.com/ee/ssh/ Gitlab docs] for how to do that. &lt;br /&gt;
&lt;br /&gt;
=== Creating a merge request ===&lt;br /&gt;
&lt;br /&gt;
Now that you&#039;re all setup you have to fork the repository you want to contribute to, for example if you want to open a merge request for aports you would have to fork [https://gitlab.alpinelinux.org/alpine/aports alpine/aports], see the [https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html#creating-a-fork Gitlab docs] if you&#039;re having problems with that. Other repositories belonging to Alpine Linux live in the [https://gitlab.alpinelinux.org/alpine Alpine organisation]. If you already have an old fork, first clone it and then update it as shown below.&lt;br /&gt;
&lt;br /&gt;
After forking you can clone the repository like so:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git clone git@gitlab.alpinelinux.org:$USER/$REPO.git}}&lt;br /&gt;
&lt;br /&gt;
Replace $USER with the nickname of your Gitlab account and $REPO with the repository you want to work on. Now you can change to another branch (e.g. the name of the package you want to edit) with:&lt;br /&gt;
&lt;br /&gt;
(If necessary, update an old fork first, see [[#Rebasing against Alpine Linux&#039;s master|rebasing]], below)&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git checkout -b pkgname}}&lt;br /&gt;
&lt;br /&gt;
Do your changes now and then push with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git push -u origin $branchname }}&lt;br /&gt;
&lt;br /&gt;
Gitlab will print an URL to create a merge request in your terminal.&lt;br /&gt;
&lt;br /&gt;
=== Amending changes to a merge request ===&lt;br /&gt;
&lt;br /&gt;
If reviewers requested changes or if you noticed that something should be changed about your merge request&#039;s change you can simply amend your changes to the right commit and force push. So if you want to change the commit at the tip of your branch you can simply do:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git commit --amend}}&lt;br /&gt;
&lt;br /&gt;
If you want to change a commit that&#039;s not at the tip of your branch you can do:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git commit --fixup $SHA1_OF_COMMIT_YOU_WANT_TO_FIX}}&lt;br /&gt;
&lt;br /&gt;
Afterwards you have to force-push in order to update your merge request:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git push -f origin}}&lt;br /&gt;
&lt;br /&gt;
=== Rebasing against Alpine Linux&#039;s master ===&lt;br /&gt;
&lt;br /&gt;
It&#039;s best to always stay up-to-date with the state of the upstream Alpine Linux repository to ensure that no merge conflicts happen later on. To do that you first have to add a new git remote which points to the upstream repository (instead of your fork):&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git remote add upstream https://gitlab.alpinelinux.org/alpine/$REPO}}&lt;br /&gt;
&lt;br /&gt;
Now you can fetch all changes with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git fetch --all}}&lt;br /&gt;
&lt;br /&gt;
And then you can rebase with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git rebase}}&lt;br /&gt;
&lt;br /&gt;
== Submitting patches via the mailing list ==&lt;br /&gt;
&lt;br /&gt;
Patches should be created with git and submitted to [mailto:alpine-aports@lists.alpinelinux.org alpine-aports] mailing list with &#039;&#039;git send-email&#039;&#039; (which needs the &#039;&#039;git-email&#039;&#039; Alpine package).&lt;br /&gt;
&lt;br /&gt;
=== Only the last commit with &#039;git send-email&#039; ===&lt;br /&gt;
&lt;br /&gt;
To submit the last commit as a patch to [mailto:alpine-aports@lists.alpinelinux.org alpine-aports] mailing list:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|git send-email --to alpine-aports@lists.alpinelinux.org -1}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|You save the To-address (does not require &#039;--to alpine-aports@lists.alpinelinux.org&#039;) in the git config with: {{Cmd|git config sendemail.to alpine-aports@lists.alpinelinux.org}}}}&lt;br /&gt;
&lt;br /&gt;
The first line in commit message will be &#039;&#039;subject&#039;&#039; and the long description (separated with empty line) will be the body in the email. The example below shows &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
testing/packagename: new aport &amp;lt;- header&lt;br /&gt;
&lt;br /&gt;
https://example.com/packagename &amp;lt;- body&lt;br /&gt;
wonderful package&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|The git send-email command is provided by the &#039;&#039;&#039;git-email&#039;&#039;&#039; package (&#039;&#039;&#039;git-perl&#039;&#039;&#039; in v2.7 and older). }}&lt;br /&gt;
&lt;br /&gt;
See [[Development using git#Email_configuration]] on how configure SMTP Auth.&lt;br /&gt;
&lt;br /&gt;
=== Multiple commits with &#039;git send-email&#039; ===&lt;br /&gt;
&lt;br /&gt;
If you have many commits you can create a directory with patches and send them with &amp;lt;tt&amp;gt;git send-email&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;rm -Rf patches&lt;br /&gt;
mkdir patches&lt;br /&gt;
git format-patch -o patches origin&lt;br /&gt;
git send-email patches --compose --no-chain-reply-to --to alpine-aports@lists.alpinelinux.org&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You can also format patches for the last x number of commits with:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;git format-patch -x -o patches&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
This will produce the patches for each local commit in the directory &amp;quot;patches&amp;quot; and send them.&lt;br /&gt;
Use &#039;&#039;&#039;--no-chain-reply-to&#039;&#039;&#039; to avoid that each patch is sent as a &#039;&#039;reply&#039;&#039; to the previous patch.&lt;br /&gt;
&lt;br /&gt;
Eg.&lt;br /&gt;
* [PATCH 0/m]&lt;br /&gt;
** [PATCH 1/m]&lt;br /&gt;
*** [PATCH 2/m]&lt;br /&gt;
**** ...&lt;br /&gt;
&lt;br /&gt;
With the option &#039;&#039;&#039;--no-chain-reply-to&#039;&#039;&#039; the patches will be sent as a reply to the first email, the &#039;&#039;cover letter&#039;&#039; (the [PATCH 0/m]) and will make the email thread nicer.&lt;br /&gt;
Like this:&lt;br /&gt;
* [PATCH 0/m]&lt;br /&gt;
** [PATCH 1/m]&lt;br /&gt;
** [PATCH 2/m]&lt;br /&gt;
** ..&lt;br /&gt;
&lt;br /&gt;
=== Resend an updated patch ===&lt;br /&gt;
Sometimes patches are rejected due to minor issues in the patch. Do not send an incremental patch on top of your initial, bad, patch. Instead, recreate the patch and send a new, fixed version of your patch. (use &#039;&#039;git commit --amend&#039;&#039; to edit a local commit).&lt;br /&gt;
&lt;br /&gt;
When you sending a second version of the patch use &#039;&#039;&#039;--subject-prefix &amp;quot;PATCH v2&amp;quot;&#039;&#039;&#039; to indicate that this is a new version of a previously sent patch. You may also use &#039;&#039;&#039;--in-reply-to &amp;lt;message-id&amp;gt;&#039;&#039;&#039; where &amp;lt;message-id&amp;gt; the the id of email requesting the resend.&lt;br /&gt;
&lt;br /&gt;
You should also write a note on the what was changed. Use &#039;&#039;&#039;--annotate&#039;&#039;&#039; for this and write the comment under the three dashes &amp;quot;---&amp;quot; so the note is not included in the commit message. For example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
...&lt;br /&gt;
Subject: [PATCH v2] testing/mypackage: new aport&lt;br /&gt;
&lt;br /&gt;
https://example.com&lt;br /&gt;
Example package&lt;br /&gt;
---&lt;br /&gt;
Changes v1 -&amp;gt; v2:&lt;br /&gt;
 - removed depends&lt;br /&gt;
 - added zlib-dev to makedepends&lt;br /&gt;
&lt;br /&gt;
 testing/mypackage/APKBUILD | 41 +++++++++++++++++++++++++++++++++++++++++&lt;br /&gt;
 1 file changed, 41 insertions(+)&lt;br /&gt;
 create mode 100644 testing/mypackage/APKBUILD&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that the notes that are below the &amp;quot;---&amp;quot; will not be included in the commit message.&lt;br /&gt;
[[Category:Development]]&lt;br /&gt;
[[Category:Git]]&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
* [[Patch Workflow]]&lt;/div&gt;</summary>
		<author><name>Ph1lter</name></author>
	</entry>
</feed>