Renaming, Copying, and Merging

During the life of a project, we will often want to change the layout of its files and directories. This can be as simple as renaming a single file, or as complex as restructuring the entire hierarchy of files within the project.

Mercurial supports these kinds of complex changes fluently, provided we tell it what we’re doing. If we want to rename a file, we should use the hg rename[2] command to do so, so that Mercurial can do the right thing later when we merge.

We will cover the use of these commands in more detail in Copying Files.

[2] If you’re a Unix user, you’ll be glad to know that the hg rename command can be abbreviated as hg mv.

Get Mercurial: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.