Mercurial: Difference between revisions

From Wiki
Jump to navigation Jump to search
Created page with '{{lowercase title}} == Client == http://hginit.com/ The command for Mercurial is <code>hg</code>. === Create a repository === Suppose you want to set up version control for th…'
 
Line 14: Line 14:
hg commit  # has you enter a text description, then creates a first snapshot of the directory
hg commit  # has you enter a text description, then creates a first snapshot of the directory
</pre>
</pre>
=== Commit, Revert, Log ===
<pre>
hg commit  # has you enter a text description, then creates a snapshot of the directory
hg revert --all  # reverts everything back to the last commit
hg log    # shows a list of all commits
</pre>
=== Status ===
<pre>
> cp a.txt b.txt
> emacs a.txt
> rm favicon.ico
> hg status
M a.txt
! favicon.ico
? b.txt
</pre>
"M" means modified, "!" means missing, "?" means mercurial doesn't know anything about this file yet.

Revision as of 23:50, 7 November 2012

Client

http://hginit.com/

The command for Mercurial is hg.

Create a repository

Suppose you want to set up version control for the my_code directory.

cd my_code
hg init    # creates .hg directory
hg add     # adds everything from the current directory
hg commit  # has you enter a text description, then creates a first snapshot of the directory


Commit, Revert, Log

hg commit  # has you enter a text description, then creates a snapshot of the directory
hg revert --all  # reverts everything back to the last commit
hg log     # shows a list of all commits

Status

> cp a.txt b.txt
> emacs a.txt
> rm favicon.ico
> hg status
M a.txt
! favicon.ico
? b.txt

"M" means modified, "!" means missing, "?" means mercurial doesn't know anything about this file yet.