## Intro
There are two cases where you may want to merge a package that has PureOS-specific changes with its Debian counterpart: Either the PureOS changes have been incorporated upstream in the Debian package or are no longer relevant and can be dropped, or the changes are still relevant but new changes from upstream Debian should be incorporated into the PureOS package.
In any case, the PureOS package should be tracked in Git, which the `debian/master` or `debian/latest` branch present, as well as with a shared `upstream` branch. This makes merging the `debian/(master|latest)` into `pureos/(master|latest)` very easy for new package uploads.
## Dropping PureOS specific changes
If you want to resynchronize a PureOS package with the Debian version, dropping all PureOS changes, there are two options: If the Debian version of the package in its source suite is newer than the version in PureOS, you can ask the archive admins to force a synchronization from Debian, overriding the PureOS changes. If that is not the case, you can download the pristine Debian package and create a new changelog entry, but instead if the usual `XpureosY` revision use a `Xresync1` revision number.
For example, if the PureOS package version is `1.2-1pureos4`, download the pristine Debian package, give it version `1.2-1resync1` and upload it to PureOS.
If a newer Debian package becomes available, the PureOS changelog-only delta to Debian will be dropped automatically.
Please keep the Git repositories for the old PureOS package available, possibly syncing the `pureos/(master|latest)` with the `debian/(master|latest)` branch to indicate the PureOS delta has been dropped intentionally.
## Merging changes from Debian into a PureOS package
If you want to merge in Debian changes into a PureOS package, keeping some PureOS-specific changes, first merge the two packages and then give the resulting package a new revision number `Xpureos1` where `X` is the preexisting Debian revision.
Write a changelog entry like this:
```
You made a few uploads with changelog entry Sync with Debian Bullseye and a pureos version suffix. Please either remove the version suffix (replaxing it by x1 or resync1 for example) if all PureOS-specific changes have been dropped and the package can be auto-synced back to the Debian version, or tell me to do a proper override sync (only works if the version in Debian is newer than the PureOS version).
Or, if there are still remaining changes, add a changelog entry like this:
```
coolpackage (1.2-4pureos1) byzantium; urgency=medium
* Merge with Debian unstable, remaining changes:
- PureOS change 1
- Remaining PureOS change 2
-- Jane Doe <jane_doe@puri.sm> Mon, 30 Sep 2019 19:28:34 +0200
```
Please detail the changes that are still remaining, as due to the merge some PureOS delta may have been dropped and having this information is a very valuable reference for other package maintainers working with this package.
## Further reading
Ubuntu also has a nice [guide for package merging](https://wiki.ubuntu.com/UbuntuDevelopment/Merging) that is worth a read.