hg clone http://www.example1.com/hello
Make an identical copy of an existing repository.
Pull changes from a remote repository to local, but this does not update the copy of the project in current working directory.
Push changes from local repository to server.
hg push –new-branch
Push new branch to server.
Update to the tip revision.
You should invoke "hg update" once you invoke "hg pull" to reach the newest code. And your code may be merged in this step.
hg update [number]
Update working directory to the changetset specified by the number.
hg update [branch_name]
Switch to a specified branch.
Create a new changeset.
If your code was changed after you invoke "hg commit", you must invoke "hg commit" again to push your new code to server, otherwise your code will be in your local and won't be pushed to server.
hg commit –close-branch
Close a branch, hide it from the branch list.
Start a merge between the two heads.
hg megre -r 8888
Merge with a specified changeset.
Tell Mercurial to start tracking file which is not in current repository but existed in other place, then we add it to current repository.
Make file no longer belongs in current repository.
hg revert [filename]
Revert the specified file.
hg revert -r [changeset] -a
Revert all files of the specified changeset.
hg revert -a
Revert all changed files.
hg branch
To find out what the current branch is.
hg branch [new_branch_name]
Create a new branch.
List the named branches already present in current repository.
hg fetch === hg pull + hg merge
Get the history of changes in the repository.
-r / --rev
- To narrow the output of hg log down to a single revision. You can provide as many revisions as you want.
- eg: hg log -r 1 -r 3
- You can also use range notation.
- eg: hg log -r 2:4
hg log -r 4:2
- See the detail of a changed.
- eg: hg log -v(--verbose) -r 3
- See both the description and content. This displays the content of a change as a unified diff.
- eg: hg log -v -p(--patch) -r 2
Print files which have been changed. The status of a file may be:
- M (Modified)
- A (Add)
- R (Removed)
- ? (Not tracked)
Compare changes we've made to the file.
Tell us what changes would be pushed into the server repository. The changes would be pushed if a push was requested.
"hg outgoing" should be executed after "hg commit", otherwise you won't find the change of code.
Tell us what changes the hg pull command would pull into local repository, without actually pulling the changes in.
"hg incoming" should to be executed before "hg pull".
View the heads in a repository.
Roll back the last transaction. And there is no way to undo a rollback.
Copy changes from other branches onto te current branch.
Show help for a given topic.
hg graft -r 8888
commit - ci
update - up
remove - rm
incoming - in
outgoing - out
status - st
(1) hg fetch
(2) ... // Happy coding.
(3) hg fetch // Get the new changeset from others to make your code be newest before pushing your code to server.
(4) ... // Check your code.
(4) hg commit -m "push code" // Commit your code.
(5) hg push // Push to the server.
eg: hg log -v -p -r 2
hg log -vpr2