UP | HOME

HG / GIT notes

Corrected Steps for Converting Hg to Git using hg-fast-export

Install Dependencies

  • Git: sudo apt install git or brew install git (macOS)
  • Mercurial: sudo apt install mercurial or brew install mercurial (macOS)
  • Python: Usually comes pre-installed

Clone hg-fast-export

git clone https://github.com/frej/fast-export.git

Initialize a New Git Repository

mkdir new_git_repo
cd new_git_repo
git init

Run hg-fast-export

Make sure you’re still in the newly created Git repository directory. Then, run the `hg-fast-export.sh` script from there.

/path/to/fast-export/hg-fast-export.sh -r /path/to/your/mercurial_repo -A /path/to/authors.map
  • /path/to/fast-export is where you cloned the hg-fast-export tool.
  • /path/to/your/mercurial_repo is your existing Mercurial repository.
  • /path/to/authors.map is an optional author mapping file.

Finalize Git Repository

After running hg-fast-export, you’ll need to reset the Git HEAD to finalize the conversion.

git checkout HEAD

Common Issues and Troubleshooting

Error Messages

Check your dependencies and paths if you encounter errors.

Authors Mapping

Manually edit the authors.map file if author names are not mapped correctly.

Subrepositories

hg-fast-export does not support Hg subrepositories.

Resources

hg-fast-export GitHub Repo

More on Mercurial to Git Migration

Author: Marcus Kammer

Email: marcus.kammer@mailbox.org

Date: Thu, 31 Aug 2023 00:00 +0200

Emacs 29.1.90 (Org mode 9.6.11)

License: CC BY-SA 3.0