|Last modified: 16-06-2020|
This is a quick guide to using the Mercurial source control application on a Windows host as a single user.
If necessary, install Python 2.x
"Many SVN/CVS users expect to host related projects together in one
repository. This is really not what Mercurial was made for, so you should try
a different way of working. In particular, this means that you cannot check
out only one directory of a repository."
To create a new repository: File > New Repository… . Alternatively, you can use any Windows Explorer application, right-click in a directory, and choose TortoiseHg > Create Repository Here. The Workbench is updated accordingly
Back in the workbench, to add files to the new repository, check them, right-click > Add
To tell Tortoise to ignore such and such files, check them all, right-click, and choose Ignore
Edit the .hgignore file to tell Tortoise to ignore files with those extensions
To commit, click on the Commit button on the right.
After editing a file, hit the F5 key so update Tortoise.
To search the repository: View > Search > All History
To check that Mercurial is correctly installed, run "hg" anywhere.
To create a new repository, cd to where the files are located, and run "hg init". Notice the new \.hg sub-directory.
To tell Mercurial to ignore somes files, create a .hignore file at the root of this directory, and add extensions:
To add files, run "hg add".
To commit changes to the repository, run "hg commit" (or "hg com", for short). To type a comment, you can either type "hg com -m "My comment") or let hg launch a text editor.
To see the list of changes, run "hg log".
To see what changes you made to the live files up to this point, run "hg status" (or "hg st")
To see what changes you made to a live file since the last commit, run "hg diff myfile.txt"
To tell Mercurial to ignore a file from now on, run "hg remove myfile.txt": This will obviously preserve all the revisions up to this point.
To cancel the changes you made to the live files in the workdirectory and tell Mercurial to check out the latest revisions from the repository, run "hg revert -all", or "hg revert myfile.txt".
To see what the latest revision of a file looks like, run "hg cat myfile.txt". To see what it looked like in a given revision, run "hg car -r0 myfile.txt", where "r" is the revision number as shown by "hg status"; If the file is too long, you can tell Mercurial to only show the changes through "hg diff -r 0:1 myfile.txt".
To check out the latest revision and forget the changes you made to the live files, run "hg update" (or "hg up"); To go back to a given revision, run "hg up -r 123".
To see the checked out revisions, run "hg parents".
With the repository closed, use your favorite backup tool to backup the directory where the files live, including the \.hg sub-directory.
hg revert vs. hg rollback?
How to get Tortoise/CLI to create an .hgignore with default settings?