The source for all packages in Debian can be downloaded using 'apt-get source', provided that an appropriate deb-src line has been set in /etc/apt/sources.list. Sometimes, however, packages are maintained in a version control system. In this case, when making changes to a source package there are advantages to using the VCS that the maintainer uses, to ensure you're working with the most up-to-date version of the maintainer's packaging, and (sometimes) to more efficiently contribute your package changes back to the maintainer.
If apt-get source --no-act $package outputs a message like this:
NOTICE: 'fdupes' packaging is maintained in the 'Git' version control system at: git://git.debian.org/users/morph/fdupes.git
the location of the package VCS has been documented in the package's debian/control file using the appropriate Vcs-* field for the VCS in question (e.g., Vcs-Git, Vcs-Bzr, etc.). You can then download the package source from the VCS using the debcheckout command:
$ debcheckout fdupes declared git repository at git://git.debian.org/users/morph/fdupes.git git clone git://git.debian.org/users/morph/fdupes.git fdupes ... Cloning into 'fdupes'... remote: Counting objects: 118, done. remote: Compressing objects: 100% (54/54), done. remote: Total 118 (delta 50), reused 118 (delta 50) Receiving objects: 100% (118/118), 40.62 KiB | 32 KiB/s, done. Resolving deltas: 100% (50/50), done. $
Note that you must have the package for the corresponding VCS already installed on your system (in this case, git).
If using a version control system for packaging, it is strongly recommended to use the DEBCHANGE_RELEASE_HEURISTIC=changelog option to the dch command. This causes the dch command to automatically start a changelog entry for a new version when needed, and otherwise to append information to the current changelog entry, without worrying about the -i option. Releasing a new version of the package can then be done with the command dch -r.
To add this option to your dch config, run the following command:
$ echo 'DEBCHANGE_RELEASE_HEURISTIC=changelog' >> ~/.devscripts
There are various VCS-specific tools that can make it easier to work with source packages in VCS. You can find information about some of these tools elsewhere in the wiki:
In addition to official VCS branches for many of the packages included in Debian, ?Launchpad includes imports of the full archive history of Debian and Ubuntu into bzr. With the bzr package installed, you can grab branches for any Debian or Ubuntu package using one of:
$ bzr branch lp:ubuntu/$package $ bzr branch lp:debian/$package