TortoiseHg 命令

来源:互联网 发布:方便面 数据报告 编辑:程序博客网 时间:2024/05/16 06:34

1. Kiln Command

hg clone

hg clone http://www.example1.com/hello

Make an identical copy of an existing repository.

hg pull

Pull changes from a remote repository to local, but this does not update the copy of the project in current working directory.

hg push

Push changes from local repository to server.

hg push –new-branch

Push new branch to server. 

hg update

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 default/new_branch

Switch to default branch or new_branch branch.

hg commit

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.

hg merge

Start a merge between the two heads. 

hg megre -r 8888

Merge with a specified changeset.

hg add

Tell Mercurial to start tracking file which is not in current repository but existed in other place, then we add it to current repository.

hg remove

Make file no longer belongs in current repository.

hg revert

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 branches

List the named branches already present in current repository.

hg fetch

hg fetch === hg pull + hg merge

hg log

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

hg status

Print files which have been changed. The status of a file may be:- M (Modified)- A (Add)- R (Removed)- ? (Not tracked)

hg diff

Compare changes we've made to the file. 

hg outgoing

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.

hg incoming

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".

hg heads

View the heads in a repository. 

hg rollback

Roll back the last transaction. And there is no way to undo a rollback.

hg graft

Copy changes from other branches onto te current branch.

hg help

Show help for a given topic.

hg graft -r 8888

2. Aliases

commit - ciupdate - upremove - rmincoming - inoutgoing - outstatus - st 

3. Team workflow

(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.

4. Others

  • Short options can be written together.
    eg: hg log -v -p -r 2        hg log -vpr2
  • Most commands will print more output when passed a -v (or –verbose) option, and less when passed -q (or –quiet).
  • You can’t push anything if you don’t add a commit.
原创粉丝点击