# phpman > man > origtargz(1)

[ORIGTARGZ(1)](https://www.chedong.com/phpMan.php/man/ORIGTARGZ/1/markdown)                                                                            [ORIGTARGZ(1)](https://www.chedong.com/phpMan.php/man/ORIGTARGZ/1/markdown)



## NAME
       origtargz - fetch the orig tarball of a Debian package from various sources, and unpack it

## SYNOPSIS
       **origtargz** [_OPTIONS_] [**--unpack**[=**no**|**once**|**yes**]]
### origtargz --help

## DESCRIPTION
       **origtargz** downloads the orig tarball of a Debian package, and also unpacks it into the
       current directory, if it just contains a _debian_ directory. The main use for **origtargz** is with
       debian-dir-only repository checkouts, but it is useful as a general tarball download wrapper.
       The version number for the tarball to be downloaded is determined from _debian/changelog_. It
       should be invoked from the top level directory of an unpacked Debian source package.

       Various download locations are tried:

       •   First, an existing file is looked for.

       •   Directories given with **--path** are searched.

       •   **pristine-tar** is tried.

       •   **pristine-lfs** is tried.

       •   **apt-get** **source** is tried when **apt-cache** **showsrc** reports a matching version.

       •   Finally, **uscan** **--download** **--download-current-version** is tried.

       When asked to unpack the orig tarball, **origtargz** will remove all files and directories from
       the current directory, except the debian directory, and the VCS repository directories. _Note_
       _that_ _this_ _will_ _drop_ _all_ _non-committed_ _changes_ for the patch system in use (e.g. source format
       "3.0 (quilt)"), and will even remove all patches from the package when no patch system is in
       use (the original "1.0" source format). Some VCS control files outside _debian/_ preserved
       (_.bzr-builddeb_, _.bzr-ignore_, _.gitignore_, _.hgignore_), if stored in VCS.

       The default behavior is to unpack the orig tarball if the current directory is empty except
       for a _debian_ directory and the VCS files mentioned above.

## NOTES
       Despite **origtargz** being called "targz", it will work with any compression scheme used for the
       tarball.

       A similar tool to unpack orig tarballs is [**uupdate**(1)](https://www.chedong.com/phpMan.php/man/uupdate/1/markdown). **uupdate** creates a new working
       directory, unpacks the tarball, and applies the Debian _.diff.gz_ changes. In contrast,
       **origtargz** uses the current directory, keeping VCS metadata.

       For Debian package repositories that keep the full upstream source, other tools should be
       used to upgrade the repository from the new tarball. See [**gbp-import-orig**(1)](https://www.chedong.com/phpMan.php/man/gbp-import-orig/1/markdown) and **svn-**
       [**upgrade**(1)](https://www.chedong.com/phpMan.php/man/upgrade/1/markdown) for examples. **origtargz** is still useful for downloading the current tarball.

## OPTIONS
### -p --path
           Add _directory_ to the list of locations to search for an existing tarball.  When found, a
           hardlink is created if possible, otherwise a symlink.

### -u --unpack
           Unpack the downloaded orig tarball to the current directory, replacing everything except
           the debian directory. Existing files are removed, except for _debian/_ and VCS files.
           Preserved are: _.bzr_, _.bzrignore_, _.bzr-builddeb_, _.git_, _.gitignore_, _.hg_, _.hgignore_, __darcs_
           and _.svn_.

           **no**  Do not unpack the orig tarball.

           **once** (default when **--unpack** is not used)
               If the current directory contains only a _debian_ directory (and possibly some
               dotfiles), unpack the orig tarball. This is the default behavior.

           **yes** (default for **--unpack** without argument)
               Always unpack the orig tarball.

### -d --download-only
           Alias for **--unpack=no**.

### -t --tar-only
           When using **apt-get** **source**, pass **--tar-only** to it. The default is to download the full
           source package including _.dsc_ and _.diff.gz_ or _.debian.tar.gz_ components so **debdiff** can be
           used to diff the last upload to the next one. With **--tar-only**, only download the
           _.orig.tar.*_ file.

### --clean
           Remove existing files as with **--unpack**. Note that like **--unpack**, this will remove
           upstream files even if they are stored in VCS.

## SEE ALSO
       [**debcheckout**(1)](https://www.chedong.com/phpMan.php/man/debcheckout/1/markdown), [**gbp-import-orig**(1)](https://www.chedong.com/phpMan.php/man/gbp-import-orig/1/markdown), [**pristine-tar**(1)](https://www.chedong.com/phpMan.php/man/pristine-tar/1/markdown), [**svn-upgrade**(1)](https://www.chedong.com/phpMan.php/man/svn-upgrade/1/markdown), [**uupdate**(1)](https://www.chedong.com/phpMan.php/man/uupdate/1/markdown)

## AUTHOR
       **origtargz** and this manpage have been written by Christoph Berg <<_myon@debian.org_>>.



Debian Utilities                             2026-03-04                                 [ORIGTARGZ(1)](https://www.chedong.com/phpMan.php/man/ORIGTARGZ/1/markdown)
