Migrating from mercurial to git
Having done this migration path a few times now, and having to remind myself from a couple of sources with a couple of caveats I’m including a quick guide for the migration of single branch mercurial repositories to git repositories.
For full disclosure, a lot of this was taken from this stack overflow ticket. Specifically Timmmm’s answer.
- Open command line, and create the an empty directory for the git repository
git init --bare .gitin the new directorycdto your mercurial repositoryhg bookmarks masterin the mercurial repositoryhg push c:/path/to/repository- Go back to the git repository
git config --bool core.bare false - All files were in a deleted state for me, so ran
git checkout master git remote add origin ssh://path/to/repogit push
If you’ve not applied a .gitignore file, add one now. To pick up .gitignore and apply to the repository, run the command git rm -r --cached