你要做的第一件事就是设置用户名。可以通过编辑或创建~/.hgrc
(Windows系统下则是%USERPROFILE%\Mercurial.ini
)并加入如下内容
[ui]
username = John Doe <john@example.com>
试着键入hg
分布式软件配置管理工具 - 水银
基本命令:
add add the specified files on the next commit
annotate show changeset information by line for each file
clone make a copy of an existing repository
commitcommit the specified files or all outstanding changes
diff diff repository (or selected files)
exportdump the header and diffs for one or more changesets
forgetforget the specified files on the next commit
init create a new repository in the given directory
log show revision history of entire repository or files
merge merge working directory with another revision
pull pull changes from the specified source
push push changes to the specified destination
removeremove the specified files on the next commit
serve start stand-alone webserver
statusshow changed files in the working directory
summary summarize working directory state
updateupdate working directory (or switch revisions)
(use "hg help" for the full list of commands or "hg -v" for details)
你还可以通过使用hg help
获取完整的命令列表
mkdir project
cd project
hg init
现在我们有了全新的仓库
用hg add
添加所有未被最终的文件,或者用hg add <file>
追踪单个文件
hg commit -m "message"
或者你也可以用
hg commit
然后在打开的文本编辑器中输入留言
hg log
hg revert --all #将所有文件恢复到上次提交时的状态
hg revert <file> #回复单个文件
hg status
会告诉你这个目录下有什么变化
?代表未追踪,M代表已修改,R代表在下一次提交时会被移除,A表示已加入追踪
hg cat <file> #最后一次的提交
hg cat -r 0 <file> #在版本0时的状态
hg diff -r 0:1 <file> #在版本0,1间有何改动
hg update #将目录变为最新状态
hg update -r 0 #将目录变为版本0时的状态