This tutorial walks you though making a debian packaging git repo where upstream branch is the upstream git repo.

We will take libvarnam as an example.

mkdir varnam

We need to make initial debian directory template with debmake (for golang, ruby or node packages, there are tools that will do this directly). We need a release tarball for this.

cd varnam
wget https://github.com/varnamproject/libvarnam/archive/v3.2.6.tar.gz
mv v3.2.6.tar.gz libvarnam-3.2.6.tar.gz
tar -zxvf libvarnam-3.2.6.tar.gz
cd libvarnam-3.2.6
debmake
cd ..

Now initialize and pull the upstream repo,

mkdir libvarnam
cd libvarnam
git init
git checkout -b upstream
git remote add upstream https://github.com/varnamproject/libvarnam.git
git pull upstream master --tags

Now copy the debian directory created by debmake to your repo.

git checkout -b debian/sid v3.2.6
cp -r ../libvarnam-3.2.6/debian/ .
git add debian/
git commit -m "Add debian directory created by debmake"

Now create debian/gbp.conf to make debian/sid as debian-branch. Also run origtargz automatically after gbp clone.

[DEFAULT]
debian-branch=debian/sid

[clone]
postclone=origtargz

git add debian/gbp.conf
git commit debian/gbp.conf -m "Add debian-brach=debian/sid, run origtargz automatically"

Now you can build your package

gbp buildpackage

Fix build errors and make lintian happy.