dgit cheatsheet

Date: 2022/05/27 (initial publish), 2023/11/08 (last update)

Source: en/note-00030.md

Previous Post Top Next Post

TOC

dgit Cheatsheet

Create new Debian packaging repository for salsa.debian.org as follows:

 $ git clone -o upstream $HTTPS_UPSTREAM_URL $REPO_NAME
 $ git remote set-url --push upstream DONT_PUSH
 $ git checkout -b debian/latest
  ... debianize as dgit-maint-merge(7) workflow
      Patch applied source tree (single-debian-patch, auto-commit)
      Ensure to have d/changelog matching the latest upstream tag
      Use "git deborig" to make upstream tarball
 $ git deborig
 $ sbuild # test build
 $ git remote add origin $GIT_MY_URL
 $ git push --set-upstream origin debian/latest
  ... hack
 $ sbuild # test build
  ...
 $ dgit sbuild
 $ dgit push-source --deliberately-not-fast-forward
 $ git push

This repository can be obtained later and updated as:

 $ git clone $GIT_MY_URL
 $ git remote add upstream $HTTPS_UPSTREAM_URL
 $ git remote set-url --push upstream DONT_PUSH
 $ git pull --no-rebase upstream $main
  ... hack
 $ git deborig
 $ sbuild # test build
  ...
 $ dgit sbuild
 $ dgit push-source
 $ git push

Here

 $HTTPS_UPSTREAM_URL   upstream repo (remote=upstream) URL for readonly access
 $REPO_NAME            repo directory name
 $GIT_MY_URL           my repo (remote=origin) URL for write access via SSH
 $main = master|main   tracking branch name at remote=upstream
 debian/latest         branch name used for Debian package (DEP-14)
                       https://dep-team.pages.debian.net/deps/dep14/
 sbuild                set up as debmake-doc suggests with piuparts/lintian

To prevent accidental push to upstream, there are 2 strategies

 $ git remote set-url --push upstream DONT_PUSH
 $ git branch --unset-upstream [$main]

To set origin without pushing with --set-upstream

 $ git branch -u $new_origin $branch_name

For upload trouble resolution, do one of the following

 $ dgit push --new                           # new in this suite
 $ dgit push --deliberately-not-fast-forward # first time ever
 $ dgit push --overwrite                     # not descendant

The difference of PUSH operation

Normally:

 $ dgit push-source # source only upload

In some rare cases (security archive/newly added package)

 $ dgit push        # source + binary upload
Previous Post Top Next Post