Forwarding Patches to Upstream

When you create patches that are not Debian-specific, like patches intended to fix bugs in upstream source, you will most likely need to forward them to the upstream. Forwarding a patch entails creating an account with the VCS the upstream uses ( if you don't have one yet ) , and sending a pull request/merge request from your fork to the upstream repository .

Most upstreams for Javascript modules use either github or gitlab as their VCS. For simplicity, in this post we'll be referencing github as VCS and assume we're forwarding a patch to typanion package to use @rollup/plugin-typescript instead of @wessberg/rollup-plugin-ts . Let's call our working branch use-rollup-plugin-typescript . Note that pull request is to github what merge request is to gitlab

Download the upstream code

git clone <url.git>
cd typanion
git checkout -b use-rollup-plugin-typescript
yarn install

Make changes, run build and test scripts

Make all the changes necessary for this fix in your working branch, run the package build and test scripts as found in package.json The changes you've made should reflect the exact changes your debian/patches applies to the affected files. Ensure that the build and test succeeds and commit your changes

Push changes to remote fork and create a PR to upstream

git push -u origin use-rollup-plugin-typescript

Update your Patch headers

Once you've created a pull request for the patch, set the url of the pull request as the value of the Forwarded header of the patch.

Notes:

Different organisations follow different formats of commit messages. Read the CONTRIBUTING.md or any contributing guide of the project before creating a pull request.

When upstream accepts and merges your pull request ( merge request in gitlab), your proposed changes will be avialable in their next release. By then, you can update the debian package to the new upstream version and no longer need to keep/maintain the patches. Check this pull request in practice: https://github.com/arcanis/typanion/pull/8