Hg To Git Conversion
Try hg clone git or hg clone git ssh for more information and instructions see hg help git list of commands.
Hg to git conversion. Here s how you make a bare git repository. Gclear clear out the git cached data gexport export commits from mercurial to git gimport import commits from git to mercurial git cleanup clean up git commit map after history editing gverify verify that a mercurial rev matches the corresponding git rev use hg help v hggit. Navigate to the mercurial repository you wish to convert. The hg git mercurial plugin.
Hg bookmarks hg and having done that you can now push to your git repository with the. Git init bare git repo step 4 push to git from mercurial. The hg bookmark is necessary to prevent problems as otherwise hg git pushes to the currently checked out branch confusing git. To get the changes in master use the following command only necessary in the first run later just use git merge or rebase.
This assumes you already have git installed on your environment. This means you can collaborate on git based projects from mercurial or use a git server as a collaboration point for a team with developers using both git and mercurial. This is the hg git plugin for mercurial adding the ability to push to and pull from a git server repository from mercurial. This will create a branch named hg in the git repository.
Hg git does not convert between mercurial named branches and git branches as the two are conceptually different. For each branch found via hg branches run this command. In order to do the conversion you ll need to open your powershell command prompt navigate to your mercurial repository and then execute in order. To convert my mercurial repositories to git i decided to take advantage of a utility called hg fast export.
Then restart tortoisehg and perform a pull. Hgext bookmarks git intree true convert mercurial to git. This will restore the original commit you had modified move the bookmark to the tip of the newly created commit only needed if using the deleted bookmarks workaround. Hg bookmark r default master hg gexport debug this creates a git bare repository.
As a result i decided to switch from mercurial to git and have put together this little tutorial to on how to convert a mercurial repository to git using hg fast export. Instead it uses mercurial bookmarks to represent the concept of a git branch hg git mercurial plugin readme. Then perform a forced push.