How to create a local git clone of a mercurial repo?

Harvey Chapman hchapman-hg at 3gfp.com
Tue Dec 16 16:37:05 UTC 2014


On Dec 16, 2014, at 11:12 AM, Harvey Chapman <hchapman-hg at 3gfp.com> wrote:
> I remembered that git updates working copies when you push.

Actually, I don’t think that statement is correct. I think it’s more like git doesn’t allow you to push to an actively checked out reference. And in this case, there must be an implied, yet invisible null commit which is on the master branch/reference.

> My other question still stands though. Is there a better way? I don’t really need to update the paths in my local hgrc, but usually when I make these repos, my intent is to keep pushing my changes to them.

I realize now that I didn’t need the initial pull, either:

hg bookmarks -r tip master

# These next two steps are only really needed for ongoing development and pushes.
# Otherwise, just pass the git repo path to hg push
hg update master
echo -e "[paths]\ndefault = ../test.git" > .hg/hgrc

git init —bare ../test.git
hg push




More information about the Mercurial mailing list