Ir para o conteúdo

Software livre Brasil

 Voltar a git-export-d...
Tela cheia


13 de Agosto de 2011, 0:00 , por Software Livre Brasil - 0sem comentários ainda | Ninguém está seguindo este artigo ainda.
Visualizado 954 vezes


git export-debian-patches


git export-debian-patches [OPTIONS]


This program must be run from inside a Debian source package that is maintained in a Git repository. It will generate a debian/patches/ directory with one patch for each commit in the Debian packaging branch that do not touch files under debian/.

Commits that are already applied upstream are not exported. Commits were not applied upstream, but were reversed by later commits, are also not applied.

By default, the Debian packaging branch is assumed to be the master branch, and the upstream branch is assumed to be upstream branch. You can change these defaults with command-line options (see below).


This tool makes a fair number of assumptions of how the package is being maintained in a Git repository:

Debian packaging and upstream source are kept in separate branches.

The upstream sources branch is merged into the Debian packaging branch.

Changes to the upstream source made are merged into the Debian package branch.

There are no commits that touch both files under debian/ and files outside it, i.e. all commits are either strictly Debian packaging changes or upstream source changes.

Last, but not least, each commits that changes upstream source and is merged into the Debian packaging branch is self-contained and makes sense on its own. If you have a series of commits that only make sense together, you will end up with one patch for each commit.

One important assumption that this tools does not make is how exactly you manage these patches. You can keep them on topic branches and merge everything together with the Debian packaging in a build branch. You can keep commits applied in the main Debian packaging branch. You can have a separate branch with all patches for upstream and merge it into the Debian packaging branch. As long as all the needed commits are merged into the master branch (or whatever branch you pass to the --debian-branch option), the relevant commits will be exported as patches into debian/patches/.



Uses BRANCH as Debian packaging branch. Default: "master".


Uses BRANCH as upstream branch. Default: "upstream".


First, all commits present in the Debian packaging branch but not in the upstrean branch are listed.

Then a list of upstream commits is created by picking the commits in the original list that do not change any files under debian/.

Then a local temporary branch is created off the upstream branch, and all selected commits are cherry-pick'ed into that branch. The temporary branch is then rebased against the upstream branch. This will drop all commits that were already applied upstream.

After removing commits already applied upstream, the remaining patches are exported to a temporary directory.

In that directory we exclude any pair of patches in which the later reverses the former. The fact that one patch reverses the other is detected using combinediff(1): if patches p1 and p2 result in an empty patch when combined, then p2 reverts p1.

Finally the Debian packaging branch is checked out, the temporary branch is removed, all files in debian/patches/ are deleted, the patches are copied in debian/patches/ and a patch series file is written to debian/patches/series.


git-buildpackage(1), git-rebase(1), git-format-patch(1), dpkg-source(1), combinediff(1).


Copyright (c) 2011, Antonio Terceiro <>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.

0sem comentários ainda

Enviar um comentário

Os campos são obrigatórios.

Se você é um usuário registrado, pode se identificar e ser reconhecido automaticamente.