annotate README.md @ 43:e965895856e9

initial readme file
author Scott Chacon <schacon@gmail.com>
date Tue, 28 Apr 2009 18:18:26 -0700
parents
children 234bb5784c8b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
43
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
1 Hg-Git Mercurial Plugin
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
2 =======================
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
3
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
4 This is the Hg-Git plugin for Mercurial, adding the ability to push and pull to/from a Git server repository from Hg. This means you can collaborate on Git based projects from Hg, or use a Git server as a collaboration point for a team with developers using both Git and Hg.
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
5
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
6 The Hg-Git plugin can convert commits/changesets losslessly from one system to another, so you can push via an Hg repository and another Hg client can pull it and thier changeset node ids will be identical - Mercurial data does not get lost in translation. It is intended that Hg users may wish to use this to collaborate even if no Git users are involved in the project, as it may provide some advantages if you're using Bookmarks (see below).
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
7
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
8 Commands
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
9 =========
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
10
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
11 You can clone a Git repository from Hg by running `hg gclone [url]`. It will create a directory appended with a '-hg', for example, if you were to run `hg gclone git://github.com/schacon/munger.git` it would clone the repository down into the directory 'munger-hg', then convert it to an Hg repository for you.
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
12
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
13 hg gclone git://github.com/schacon/munger.git
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
14
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
15 If you are starting from an existing Hg repository, you have to setup a Git repository somewhere that you have push access to, add it as a Git remote and then run `hg gpush` from within your project. For example:
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
16
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
17 $ cd hg-git # (an Hg repository)
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
18 $ hg gremote add origin git@github.com/schacon/hg-git.git
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
19 $ hg push
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
20
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
21 This will convert all our Hg data into Git objects and push them up to the Git server.
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
22
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
23 Now that you have an Hg repository that can push/pull to/from a Git repository, you can fetch updates with `hg gfetch`.
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
24
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
25 $ hg gfetch
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
26
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
27 That will pull down any commits that have been pushed to the server in the meantime and give you a new head that you can merge in.
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
28
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
29
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
30 Hg Bookmarks Integration
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
31 ========================
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
32
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
33 Hg-Git works will use your bookmarks if you have any or have the bookmarks extension enabled. It will allow you to push your bookmarks up to the Git server as branches and will pull Git branches down and set them up as bookmarks if you want.
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
34
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
35 This is actually pretty cool, since you can use this extension to transfer your Hg bookmarks via the Git protocol, rather than having to scp them, as the Hg transfer protocol does not currently support transferring bookmarks.
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
36
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
37 Installing
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
38 ==========
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
39
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
40 Clone this repository somewhere and make the 'extensions' section in your `~/.hgrc` file look something like this:
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
41
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
42 [extensions]
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
43 hgext.bookmarks =
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
44 hgext.hg-git = [path-to]/hg-git
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
45
e965895856e9 initial readme file
Scott Chacon <schacon@gmail.com>
parents:
diff changeset
46 That will enable the Hg-Git extension for you. The bookmarks section is not compulsory, but it makes some things a bit nicer for you.