HG / GIT notes
Corrected Steps for Converting Hg to Git using hg-fast-export
Install Dependencies
- Git:
sudo apt install git
orbrew install git
(macOS) - Mercurial:
sudo apt install mercurial
orbrew 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.