TortoiseHg 命令

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 [branch_name]

Switch to a specified 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

hg branch

To find out what the current branch is. 

hg branch [new_branch_name]

Create a new branch.
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 - ci
update - up
remove - rm
incoming - in
outgoing - out
status - 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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值