pristine-tar can regenerate a pristine upstream tarball using only a small binary delta file and a copy of the source which can be a revision control checkout.

The package also includes a pristine-gz command, which can regenerate a pristine .gz file, and a pristine-bz2 for .bz2 files.

The delta file is designed to be checked into revision control along-side the source code, thus allowing the original tarball to be extracted from revision control.

pristine-tar is available in git at

It's also in Debian.

(I am no longer maintaining pristine-tar, it has a new maintainer now.)