it's a blog

Pushing patches to git repos

I recently wrote a blog post using the taavi/laravel-socialite-mediawiki PHP library which is hosted on, or sourcehut is “is a collection of tools useful for software development”, including git repository hosting.

I had to make a change to the library, and this was my first time contributing to a repository. The workflow was quite different from what I am used to and required quite some Googling before I came up with something that I was happy with. So here goes my workflow.


Firstly, if you haven’t used before you’ll need to create an account and set up some way of pushing code (SSH keys etc). There are some fairly good docs for this already for Setting up your account and first git repository, but you can stop at Creating a git repository.

Once you have an account set up you need to find the repository that you want to work with. In my case that is at the URL

You can find a clone URL over on the right-hand side of the repo page, and you want to go ahead and clone the repo.

git clone
Code language: PHP (php)

You then also want to fork the repo into your own account. The button is also on the right.

(You can also use your local clone to send a git email, but I didn’t want to install this tooling)

Screenshot of a repository with the clone information highlighted

You can now also navigate to your fork, in my case and add this remote to your existing local repo. I’m going to call my remote addshore.

git remote add addshore

You can now make your change locally in a branch, and push it to your fork of the repository.

# Checkout a new branch for your changes git checkout -b my-new-branch # Change your files and add them to a git commit git commit # Push then to your fork git push addshore my-new-branch
Code language: PHP (php)

When browsing your fork you’ll find a button prompting you to “Prepare a patchset”. Click this!

Screenshot of a forked repository with the prepare patchset information highlighted

You should be able to see the branch that you just pushed, and then selecting the branch you’ll also be able to see the commit that you just made. If this all looks good you can click the “Continue” button at the bottom.

Screenshot of selecting a branch to submit a patch from on

Next, you’ll be prompted for some more information. The patchset revision should be 1 to start with, and if you want to amend in the future and send new patches this can be incremented. You can also write a cover letter describing the patch that you are submitting.

Once done here you can hit the “Continue” button again.

Screenshot adding a cover level to a patch for submission

Finally, you need to say who you are sending this patch to. For me this is detailed in the README of the repo that I want to contribute to, and is ~taavi/

Enter the email, optionally CC yourself, and hit “Send patchset”

Screenshot selecting an email to send a patch to

Your patchset should now be sent, and you can go and view this in the inbox that you sent it to.

For my patch, the inbox is at and my patch specifically is 27991

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.