Por qué migrar
Mercurial y Git son sistemas hermanos. Migrar es principalmente una cuestión de tooling.
La herramienta estándar: fast-export
git clone https://github.com/frej/fast-export.git
cd ~/path-to-hg-repo
git init ../git-repo
cd ../git-repo
~/fast-export/hg-fast-export.sh -r ../path-to-hg-repo
git checkout HEAD
Mapeo de autores
# authors.txt
"Jane Doe" = "Jane Doe <[email protected]>"
"bob" = "Bob Smith <[email protected]>"
~/fast-export/hg-fast-export.sh -r ../hg-repo -A authors.txt
Manejo de branches
Los named branches de Mercurial no son lo mismo que los branches de Git. Los bookmarks mapean más limpiamente. Pasa -B para migrar bookmarks como branches Git.
Branches cerradas
git for-each-ref refs/heads/closed-* --format='%(refname:short)' \
| xargs -n 1 git branch -D
Tags
hg tags
git tag
Verificar integridad
hg log --template '{node}\n' | wc -l
git log --all --pretty=format:'%H' | wc -l
hg cat -r <hg-rev> path/to/file > /tmp/hg-file
git show <git-sha>:path/to/file > /tmp/git-file
diff /tmp/hg-file /tmp/git-file
Push a un host Git
git remote add origin https://github.com/team/repo.git
git push -u origin --all
git push origin --tags
Traducción de workflow
Los usuarios de Mercurial suelen sorprenderse con el índice de Git. hg pull equivale a git fetch, no a git pull. hg commit hace commit de todo lo rastreado; git commit hace commit del índice.
Extensiones y hooks
El sistema de extensiones de Mercurial no tiene contraparte directa en Git. mq → git rebase -i. histedit → también git rebase -i.
Cuidados posteriores
Mantén el repo Mercurial de solo lectura durante al menos un ciclo de release.