MacHg icon

Quick Start

Mercurial

If you are not familiar with Mercurial or any other revision control system, then see one of the starting tutorials below or Definitive Guide : revision control primer

Create a new Repository

Open MacHg, then drag and drop a folder onto the left sidebar. If the folder contains an existing Mercurial repository, you have just started managing it with MacHg. If it is not an existing Mercurial repository, you will be given the option to transform the given folder into a Mercurial repository.

Add Files to the Repository

In the Browser View, select the entire contents of the folder you just added, ie all files and folders in the repository folder. With the files and folders selected, choose the menu Action > "Add Selected Files", to add the selected files to the new MacHg repository. These files are now marked for addition. Now choose the menu Action > "Commit Selected Files..." to commit these changes. In the commit dialog enter an informative message like "initializing my repository with the files that I want."

Perform operations on the Repository

Now in some external application (eg., xcode, bbedit, etc) make some edits to the files you have just added, and save your edits. Switch back to MacHg. You should see that the files are marked as modified in MacHg. Now select the modified files in MacHg again and choose the menu Action > "Diff Selected Files". After reviewing the differences, save these changes into the Mercurial repository using Action > "Commit Selected Files..."

Add a Server

A server repository is a repository that is resident on a server and not resident on your local machine. Since such a repository is on a server, MacHg can only record a reference to this remote repository. To work with a server repository you must first make a local clone of it on your machine, and then work with this local repository.

To add an example server, choose Repository > "Add Server Repository...". In the ensuing dialog enter http://selenic.com/repo/hello in the Sever URL field, and enter an informative name in the short name field, eg. hellorepo. Click the button "Add Server" to create the bookmark.

Now with the new server bookmark selected in the sidebar, choose Repository > "Clone...". In the clone sheet that has popped up, enter a local path where you are going to clone this server to, together with a new shortname and hit "Clone Repository". This will give you a local clone of the example repository, hello, which is resident on selenic.com (the creators of Mercurial). Then you can modify the files in this repository and commit them. (You can't push changes from your repository to selenic's hello repository because you are not allowed write access to this repository.)

Bonus Points! Create a BitBucket account

Go to bitbucket and create your own account. You can host a private repository (or public repository) there for free. After experimenting with the functionality, you can upgrade your account for other people on your team to access it, etc. (I have no relation to bitbucket; it's just a neat site if you are using Mercurial. Of course, if your company or team already has a Mercurial host somewhere, then use that...)


Related Topics

About MacHg Documents

Create a new Repository

Manage an existing Repository

Clone a Repository

View the files in a Repository

View the history of a Repository

Pull changes from other Repositories into your Repository

Push changes in your Repository to other Repositories

Merging your changes

External Mercurial Tutorials

Official Mercurial Tutorial

Hg Init: a Mercurial tutorial

Mercurial Kick Start

Branching in Mercurial

MDG: Merging work

Mercurial tips