Questions tagged [mercurial]

Mercurial is a fast, open-source DVCS (Distributed Version Control System).

Mercurial is a distributed version control system, . It is dedicated to speed and efficiency with a sane user interface. The main part of the code is written in , with a small part in . The project is open-source, distributed under the GPL.

External Links ==============

Please report bugs to the bug tracker instead of posting them here on Stack Overflow. Otherwise the Mercurial team may not see them, and you will become frustrated from the lack of response.

Internal Links ==============

This is a compilation of information on using Mercurial for beginners for practical use.

Beginner - a programmer who has touched source control without understanding it very well.

Practical - covering situations that the majority of users often encounter - creating a repository, branching, merging, pulling/pushing from/to a remote repository, etc.

Notes:

  • Explain how to get something done rather than how something is implemented.
  • Deal with one question per answer.
  • Answer clearly and as concisely as possible.
  • Edit/extend an existing answer rather than create a new answer on the same topic.
  • Please provide a link to the Mercurial wiki or the HG Book for people who want to learn more.

Questions =========

Installation/Setup

Working with the code

Tagging, branching, releases, baselines

Other

8242 questions
64
votes
5 answers

How do I "switch" with Mercurial

How do I do what svn switch does, in Mercurial? That is change my working directory to switch to another branch in the repository?
Jonas Meyer
  • 803
  • 1
  • 6
  • 7
63
votes
6 answers

How do I clone a sub-folder of a repository in Mercurial?

I have a Mercurial repository containing a handful of related projects. I want to branch just one of these projects to work on it elsewhere. Is cloning just part of a repository possible, and is that the right way to achieve this?
James Hopkin
  • 13,797
  • 1
  • 42
  • 71
63
votes
2 answers

Graft vs. Transplant

The release announcement for Mercurial 2.0 mentions a new graft command, which on first sight looks similar to the transplant extension. What is the difference between these two? Does cherry picking with graft solve any problems that existed with…
Lars Tackmann
  • 20,275
  • 13
  • 66
  • 83
63
votes
2 answers

Mercurial: Globally Ignore Files

I know about .hgignore and how I can ignore files on a project-by-project basis. I want to ignore stuff for all Mercurial repositories. Is there something I can stick in .hgrc? Or put a .hgignore in my $HOME path (I tried that already but maybe I…
mikeycgto
  • 3,368
  • 3
  • 36
  • 47
63
votes
13 answers

How should I use Mercurial as a lone developer?

I've decided that I want to use Mercurial for a small, personal project. Most of the help I've read about it talks about merging changes between multiple users. Since I'm solo, that's not going to happen. Should I have multiple repositories? My…
Jay Bazuzi
  • 45,157
  • 15
  • 111
  • 168
63
votes
3 answers

Using Mercurial in a Large Organization

I've been using Mercurial for my own personal projects for a while, and I love it. My employer is considering a switch from CVS to SVN, but I'm wondering whether I should push for Mercurial (or some other DVCS) instead. One wrinkle with Mercurial…
Kristopher Johnson
  • 81,409
  • 55
  • 245
  • 302
63
votes
4 answers

Is possible to change the default diff tool in Mercurial?

Every time I do an hg diff file.ext I end up using a console diff application. I would like to use Kdiff3 or WinMerge (I'm using Windows). Is there a way to change that? I can't find a reference in Mercurial documentation (I'm not talking about…
Tute
  • 6,943
  • 12
  • 51
  • 61
63
votes
10 answers

Mercurial (and, I guess Git) with Dropbox: any drawbacks?

I have a Mercurial repository for a personal project, and I have been storing the master repository in my Dropbox for a few weeks now (something along this line; and I understand it's also possible with git). The idea is that it serves both as a…
daphshez
  • 9,272
  • 11
  • 47
  • 65
63
votes
1 answer

Mercurial branching and bookmarks

I read some information about named branches and working with bookmarks. Unfortunately I still don't see a difference between them. Is there any? Is there any difference between: hg branch blah hg up blah and hg bookmark blah hg up blah ? Why…
viraptor
  • 33,322
  • 10
  • 107
  • 191
62
votes
3 answers

What's a good way to organize projects with shared dependencies in Mercurial?

Currently, I'm moving from a legacy version control system and moving my group's project to mercurial. As one example of the kinds of code I'm moving, I have a 25+ project Visual Studio solution, containing several separate application areas that…
Robert P
  • 15,707
  • 10
  • 68
  • 112
62
votes
8 answers

Using hg revert in Mercurial

I'm using Mercurial. I made a clone of a repository. For debugging, I changed a few lines of code in a java file. I did not commit those changes though. I just want to revert them back to their original state, as found in the repository. I tried hg…
user246114
  • 50,223
  • 42
  • 112
  • 149
61
votes
10 answers

Mercurial cherry picking changes for commit

Say, I made many changes to my code and only need to commit a few of those changes. Is there a way to do it in mercurial? I know that darcs has a feature like this one. I know hg transplant can do this between branches, but I need something like…
mansu
  • 993
  • 1
  • 10
  • 13
61
votes
2 answers

How can I remove the working copy from a Mercurial clone?

When cloning a repository with mercurial you can pass the -U/--noupdate flag to create a clone with no working copy. Can I remove the working copy if I forget to pass this flag at clone time? And if so, how? This is conceptually similar to this git…
richq
  • 55,548
  • 20
  • 150
  • 144
61
votes
4 answers

Can I emulate svn:externals using mercurial?

We are considering a move from SVN to Mercurial, and have encountered a stumbling block. We currently use svn:externals to automatically pull a common set of libraries into the working directory. I can't find support for anything like this in…
Eltariel
  • 1,298
  • 1
  • 11
  • 16
60
votes
2 answers

Is there a way to use a Mercurial repository as Git submodule?

I been happily using submodules to track all the libraries my project depends from. The thing is I'm using a library called core-plot that only has a public mercurial repository. I can probably mirror it in a readonly Git repository, but is this…
dvicino
  • 1,469
  • 1
  • 11
  • 19