Easy switch from Mercurial to Git

For a project I am currently working I needed to switch from Mercurial to Git. I used the method described below, that is really trivial and it works just fine. Download fast-export and extract it wherever you want. Run the following commands :

mkdir git.migration && cd !$ && git init
/path/to/fast-export/hg-fast-export.sh -r /path/to/your/mercurial/repository

And wait for a few minutes/seconds, depending on the size of your repository. In the end of the process you should get a result like :

git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects:      10000
Total objects:         5426 (       566 duplicates                  )
 blobs  :         1990 (       453 duplicates       1454 deltas)
 trees  :         3027 (       113 duplicates       1762 deltas)
 commits:          409 (         0 duplicates          0 deltas)
 tags   :            0 (         0 duplicates          0 deltas)
Total branches:           1 (         1 loads     )
 marks:           1024 (       409 unique    )
 atoms:           1030
Memory total:          2540 KiB
 pools:          2149 KiB
 objects:           390 KiB
---------------------------------------------------------------------
pack_report: getpagesize()            =       4096
pack_report: core.packedGitWindowSize =   33554432
pack_report: core.packedGitLimit      =  268435456
pack_report: pack_used_ctr            =          1
pack_report: pack_mmap_calls          =          1
pack_report: pack_open_windows        =          1 /          1
pack_report: pack_mapped              =    7542871 /    7542871
---------------------------------------------------------------------

Now run :

git checkout

Done.

Comments !

blogroll

social