Skip to content

Instantly share code, notes, and snippets.

@MarcosBL
Created January 31, 2016 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcosBL/523738192effc2955524 to your computer and use it in GitHub Desktop.
Save MarcosBL/523738192effc2955524 to your computer and use it in GitHub Desktop.
Convertir proyectos Mercurial (hg) a Git

Solo una vez, para instalar el conversor:

cd ~
git clone git://repo.or.cz/fast-export.git

Luego creamos un script hg2git para hacernos la vida más cómoda

cd ~
git init $1
cd $1
~/scripts/fast-export/hg-fast-export.sh -r $2 --force
git checkout HEAD

Y ya podemos empezar a convertir repositorios, pasando dos parámetros: 1º la carpeta destino que contendrá el repositorio git 2º la carpeta origen del repositorio mercurial

togit /ruta/nuevo/repo/git /ruta/viejo/repo/mercurial

Entramos en la nueva carpeta, añadimos el remoto, y lo subimos.

cd /ruta/nuevo/repo/git
git remote add origin http://git.dominio.com/usuario/repo.git
git push -u origin master

No olvidar convertir nuestro .hgignore a un .gitignore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment