🌻 📖 cpangitify


cpangitify - Convert cpan distribution from BackPAN to a git repository


version 0.20


 % cpangitify Foo::Bar


This script fetches all known revisions of a distribution from CPAN/BackPAN and creates a git repository with one revision and one tag for each version of the distribution.

The idea is to create a starting point for a git work flow when adopting a CPAN module for which you don't have access to the original repository. It is of course better to import from Subversion or to clone an existing git repository, but that may not be an option.

If the distribution you are migrating changed names during its history, simply specify each name it had on the command line. Be sure to specify the current name first (this will be used when creating a directory name for the repository). For example Mojolicious::Plugin::TtRenderer was once called MojoX::Renderer::TT, so you would get both names in the history like this:

 % cpangitify Mojolicious::Plugin::TtRenderer MojoX::Renderer::TT



Resume the import from CPAN. Note that any local changes will be overwritten by the CPAN upstream (your modifications will remain in the repository history).

--output | -o directory

Creat the new repository in the given directory.

--skip version

Skip the given versions. Can be specified multiple times and can be provided as a comma separated list.


Print each git command before it is executed.


The URL to use for the BackPAN index


The URL to use for BackPAN


The URL to use for metacpan.

--branch | -b

Default branch. As on 0.18 this is main by default. Previously the old git default was used.

--help | -h

Print out help and exit.


Print out version and exit.


Each commit belongs to the CPAN author who submitted the corresponding release, therefore git blame may not be that useful for the imported portion of your new repository history.

The commits are ordered by date, so where there are interleaving of releases that belong to development and production branches this simple minded script will probably do the wrong thing.

Patches are welcome.


Here are some similar projects:

The reason I am not using the latter two is that they are designed to mirror the whole of CPAN/BackPAN, but I'm mostly just interested in one or two distributions here and there.


Author: Graham Ollis <plicease@cpan.org>


Mohammad S Anwar (MANWAR)


This software is copyright (c) 2013-2022 by Graham Ollis.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.