How to package a git upstream snapshot with git-buildpackage

Prerequisites

Let us assume we want package the last upstream git snapshot of gedit-latex using git-buildpackage.

The upstream repo is at

 git://git.gnome.org/gedit-latex

and you want to package current state of branch “master”. The packaging repo is at

 git://anonscm.debian.org/collab-maint/gedit-latex.git

and the packaging work is done in branch “master”.

If there is no packaging repo, just create one!

Steps

git clone git://anonscm.debian.org/collab-maint/gedit-latex.git
cd gedit-latex
git remote add uprepo git://git.gnome.org/gedit-latex
git fetch uprepo
git branch upsnap --track uprepo/master
git branch debsnap 
git checkout debsnap
...
git-dch --debian-branch=debsnap --snapshot

(or “–release” if your intention is to publish this package)… and then edit it, mentioning the upstream snapshot you are packacing:

git show upsnap | head -n 1
gedit debian/changelog
...
git commit debian/changelog -m "Packaging `git show upsnap | head -n 1`"
git-buildpackage --git-upstream-branch=upsnap --git-debian-branch=debsnap