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
74
votes
3 answers

best practices in mercurial: branch vs. clone, and partial merges?

...so I've gotten used to the simple stuff with Mercurial (add, commit, diff) and found out about the .hgignore file (yay!) and have gotten the hang of creating and switching between branches (branch, update -C). I have two major questions…
Jason S
  • 184,598
  • 164
  • 608
  • 970
74
votes
3 answers

How do you "rollback" last commit on Mercurial?

I have a Mercurial repository that I use in local only... It's for my personal usage (so I don't "push" anywhere). I made a commit with 3 files, but after that I understood that I should do commit 4 files... Is there a way to "rollback" my last…
serhio
  • 28,010
  • 62
  • 221
  • 374
73
votes
9 answers

How do I set up Mercurial and hgweb on IIS?

I've been looking all over for decent instructions on how to get hgweb working on IIS but I haven't found much of worth. There's this "step by step" on the Mercurial wiki, but it's not very good. There's also this and this, but again, I can't find…
Kevin Berridge
  • 6,251
  • 6
  • 41
  • 42
73
votes
3 answers

How do I diff one branch with my default branch

I switched to a branch on my local repo and noticed it gave me message showing x files updated. This surprised me as I didn't know there were any differences on that branch. How do I compare that branch with the default branch to see what has…
jaffa
  • 26,770
  • 50
  • 178
  • 289
72
votes
6 answers

What's the easiest way to commit and push a single file while leaving other modifications alone?

I'm relatively new to Mercurial and my team is trying it out right now as a replacement for Subversion. How can I commit and push a single file out to another repository while leaving other modifications in my working directory uncommitted (or at…
Ted Naleid
  • 26,511
  • 10
  • 70
  • 81
71
votes
3 answers

How do I cherry-pick a single revision in Mercurial?

In Mercurial/TortoiseHg, given the following example, what is the easiest way to merge revision "G" into repo A without taking D,E and F (Assume that G has no dependency on D,E or F). Repo A: A - B - C Repo B (Clone of A) A - B - C - D - E - F -…
Tom Hubbard
  • 15,820
  • 14
  • 59
  • 86
68
votes
6 answers

Cloning a Mercurial repository over SSH

I'm having some difficulty cloning my mercurial repository over ssh. Here's what I have tried: hg clone ssh://username@username.webfactional.com/path/to/projectname projectname It's giving me this error: remote: bash: hg: command not found abort:…
Josh
  • 4,427
  • 5
  • 28
  • 27
68
votes
4 answers

Mercurial: How do you undo changes?

When using Mercurial, how do you undo all changes in the working directory since the last commit? It seems like this would be a simple thing, but it's escaping me. For example, let's say I have 4 commits. Then, I make some changes to my code. Then I…
Johnny Beegood
  • 683
  • 1
  • 5
  • 4
68
votes
8 answers

Real-world use of Mercurial with a Team Foundation Server?

My shop uses TFS & is generally happy with it with the exception of the lack of local repository commits/reverts. I'm starting to use Mercurial locally myself to help manage smaller chunks of changes, then posting them to TFS. I see that Subversion…
Kevin Won
  • 7,156
  • 5
  • 36
  • 54
67
votes
3 answers

Mercurial ignore file

I'm trying to get Mercurial to ignore a configuration file, but I'm failing to get it working. I have created a repository on my server with hg init and cloned that repository to my computer. I then want to be able to edit the configurationj file…
Tom
  • 1,651
  • 3
  • 19
  • 19
67
votes
4 answers

what's the difference between hg tag and hg bookmark?

What's the difference between a tag and a bookmark in Mercurial? I can't seem to find any discussion of how the two differ.
Jason S
  • 184,598
  • 164
  • 608
  • 970
66
votes
4 answers

Mercurial: Easy way to see changes from last commit

In Mercurial, I can see my current (uncommitted) changes by running $ hg diff Fine. But after commit, I sometimes want to see this diff again (i.e., the diff of the last changeset). I know I can achieve this by $ hg log -l 1 changeset: 1234 tag…
claasz
  • 2,059
  • 1
  • 14
  • 16
65
votes
6 answers

Find deleted files in Mercurial repository history, quickly?

You can use hg grep, but it searches the contents of all files. What if I just want to search the file names of deleted files to recover one? I tried hg grep -I but this seems to return no results.
wsorenson
  • 5,701
  • 6
  • 32
  • 29
64
votes
7 answers

Correct way to install Mercurial on Ubuntu

I am kind of new to both, Mercurial and Ubuntu. I seem to have awkwardly installed a few other software packages already, so I wanted to see how others would go about doing this. Should I use the apt-get command? If so, how would I use it in this…
Genadinik
  • 18,153
  • 63
  • 185
  • 284
64
votes
6 answers

How can I find my working revision in mercurial

In a mercurial repo I can run hg up {revision} to change the revision of my working directory, but what command can I run to discover what revision I'm looking at?
Asa Ayers
  • 4,854
  • 6
  • 40
  • 57