Skip to content

Instantly share code, notes, and snippets.

@adomingues
Created December 25, 2020 12: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 adomingues/2e8e8a0d458ad9bb1e9857b0c4ca197f to your computer and use it in GitHub Desktop.
Save adomingues/2e8e8a0d458ad9bb1e9857b0c4ca197f to your computer and use it in GitHub Desktop.
Convert hg (mercurial) to git repos
find . -maxdepth 2 -name ".hg" -type d
## convert hg to git
pip install mercurial ## apt install did not work with the conversion tool
## install conversion tool
mkdir -p ~/bin
cd ~/bin/
git clone https://github.com/frej/fast-export.git
## convert - make sure all chnages are commited
reponame="some_repo"
basedir="/home/adomingu/imb-kettinggr/adomingues/projects"
hgdir="${basedir}/${reponame}"
gitdir="${basedir}/git_repos/${reponame}"
git init ${gitdir}
cd ${gitdir}
~/bin/fast-export/hg-fast-export.sh -r ${hgdir}
git checkout HEAD
find . -maxdepth 2 -name ".hg" -type d
## convert hg to git
pip install mercurial ## apt install did not work with the conversion tool
## install conversion tool
mkdir -p ~/bin
cd ~/bin/
git clone https://github.com/frej/fast-export.git
## convert - make sure all chnages are commited
reponame="some_repo"
basedir="/home/adomingu/imb-kettinggr/adomingues/projects"
hgdir="${basedir}/${reponame}"
gitdir="${basedir}/git_repos/${reponame}"
git init ${gitdir}
cd ${gitdir}
~/bin/fast-export/hg-fast-export.sh -r ${hgdir}
git checkout HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment