@@ -46,41 +46,39 @@ <h1 class="tbar"><small>the</small> Hg-Git <small>mercurial plugin</small></h1>
46
46
< div class ='section '>
47
47
< div class ="title "> Commands</ div >
48
48
49
+ < h3 > Clone a Git repository</ h3 >
50
+
51
+ < pre > hg clone git://github.com/schacon/some-repo.git</ pre >
52
+
49
53
< p >
50
- You can clone a Git repository from Mercurial by
51
- running < code > hg clone [url]</ code > . It will create a
52
- directory with the same name as the last path component. For
53
- example, if you were to run < code > hg clone
54
- git://github.com/schacon/munger.git</ code > it would clone
55
- the repository down into the directory 'munger.git', then
56
- convert it to a Mercurial repository for you.
54
+ Like with normal < code > hg clone</ code > , you can optionally
55
+ specify a destination directory.
57
56
</ p >
58
57
59
- < pre > hg clone git://github.com/schacon/munger.git</ pre >
58
+ < h3 > Push an existing Hg repository to Git</ h3 >
59
+
60
+ < pre > $ cd mercurial-repo
61
+ $ hg bookmark -r default master # so a ref gets created</ pre >
60
62
61
63
< p >
62
- If you are starting from an existing Mercurial repository,
63
- you have to setup a Git repository somewhere that you have
64
- push access to, and then run < code > hg push [path]</ code >
65
- from within your project. For example:
64
+ To avoid specifying the repo path when you push and pull,
65
+ edit < code > .hg/hgrc</ code > and add:
66
66
</ p >
67
67
68
- < pre > $ cd hg-git # (a Mercurial repository)
69
- $ hg bookmark -r default master # make a bookmark of master for default, so a ref gets created
70
- $ hg push git+ssh://git@github.com/schacon/hg-git.git
71
- $ hg push</ pre >
68
+ < pre > [paths]
69
+ default = git+ssh://git@github.com/schacon/some-repo.git</ pre >
72
70
73
71
< p >
74
- This will convert all our Mercurial data into Git objects
75
- and push them up to the Git server. You can also put that
76
- path in the < code > [paths]</ code > section of .hg/hgrc and
77
- then push to it by name.
72
+ See
73
+ < a href ="https://www.selenic.com/mercurial/hgrc.5.html#paths ">
74
+ the Mercurial docs</ a > for more detail on path settings.
78
75
</ p >
79
76
77
+ < pre > $ hg push</ pre >
78
+
80
79
< p >
81
- Now that you have a Mercurial repository that can push/pull
82
- to/from a Git repository, you can get updates
83
- with < code > hg pull</ code > .
80
+ This will convert all Mercurial data into Git objects
81
+ and push them up to the Git server.
84
82
</ p >
85
83
86
84
< pre > $ hg pull</ pre >
0 commit comments