Mercurial for two Programmers who are (mostly) new to SCM

Written in the Mercurial mailing list

Hi Bernard,

Am Dienstag 03 Februar 2009 20:19:14 schrieb ... ...:
> Most of the docs I can find seem to assume the reader is familiar with
> existing software developemnt tools and methodologies.
> This is not the case for me.

It wasn't for me either, and I can assure you that using Mercurial becomes
natural quite quickly.

> Now, I need to coordinate with a second (also SCM clueless) programmer.
> I envision us both working the main trunk for many small day-to-day
> changes, and our own isolated repo for larger additions that we will each
> be working on.

I don't know about a HOWTO, but I can give you a short description about basic
usage and the workflow I'd use:

Basic usage

  • Just commit as you'd have done in SVN via "hg commit".
  • To get changes from others, do "hg pull -u".
    The "-u" says 'update my files'. Always commit before you pull. Otherwise "hg pull -u" will try to merge the new changes.
  • If you already committed and then pull changes from someone else, you merge
    the changes with yours via "hg merge". Merging is quite painless in Mercurial, so you can easily do it often.
  • Once you want to share your changes, do "hg push".
    Should that complain about "adding heads", pull and merge, then do the push again. If you really want to create new remote heads, you can use "hg push -f".


  • Firstoff: Create a main repository you both can push changes to. If you have ssh access to a shared machine, that's as simple as creating a repository on that machine via "hg init project".
  • Now both of you clone from that repository via
    hg clone ssh://USER@ADDRESS:path/to/project project

    (ADDRESS can be either a host or an IP).

    That's your repository for the small day to day changes.

  • If you want to do bigger changes, you create a feature clone via
    hg clone project feature1

    In that clone you simply work, pull and commit as usual, but you only push after you finished the feature.

    Once you finished the feature, you push the changes from the feature clone via "hg push" in feature1 (which gets them into your main working clone) and then push then onward into the shared repository.

That's it - or rather that's what I'd do. It might be right for you, too, and
if it isn't, don't be shy of experimenting. As long as you have a backup clone
lying around (for example cloned to a USB stick via "hg clone project
path/to/stick/project"), you can't do too much damage :)

I hope I could provide a bit of help :)

Inhalt abgleichen
Willkommen im Weltenwald!

Beliebte Inhalte news

Draketo neu: Beiträge