Mercurial 初学者:权威实用指南 [英] Mercurial for Beginners: The Definitive Practical Guide
问题描述
灵感来自 Git 初学者:权威实用指南.
这是关于初学者实际使用Mercurial的信息汇编.
This is a compilation of information on using Mercurial for beginners for practical use.
初学者 - 接触过源代码控制但不太了解的程序员.
Beginner - a programmer who has touched source control without understanding it very well.
实用 - 涵盖大多数用户经常遇到的情况 - 创建存储库、分支、合并、从/向远程存储库拉/推等.
Practical - covering situations that the majority of users often encounter - creating a repository, branching, merging, pulling/pushing from/to a remote repository, etc.
注意事项:
- 解释如何完成某事而不是如何完成某事实施.
- 每个答案处理一个问题.
- 尽可能简洁明了地回答.
- 编辑/扩展现有答案,而不是在相同的主题.
- 请提供指向 Mercurial wiki 或 HG Book 适合想要了解更多信息的人.
- Explain how to get something done rather than how something is implemented.
- Deal with one question per answer.
- Answer clearly and as concisely as possible.
- Edit/extend an existing answer rather than create a new answer on the same topic.
- Please provide a link to the the Mercurial wiki or the HG Book for people who want to learn more.
问题:
- 如何获取最新代码?
- 如何查看代码?
- 您如何提交更改?
- 您如何查看未提交的内容或状态您当前的代码库?
- 如何从存储库中删除文件?一个>
- 如何销毁不需要的提交?
- 您如何比较文件的两个修订版,或您当前的文件和以前的修订版本?
- 如何查看文件的修订历史或存储库?
- 您如何处理二进制文件(例如,visio 文档或编译器环境)?
- 如何合并同时"更改的文件?
- 如何还原变更集?
- 如何返回到以前版本的代码?
- 如何从特定变更集中提取补丁?
- 如何在不使用 Mercurial 命令的情况下记录重命名或删除文件?
- 适用于 Mercurial 的优秀 GUI/IDE 插件?优点/缺点?
- 初学者应该知道的任何其他常见任务?
- 我如何与 Subversion 交互?
- Mercurial:权威指南
- Mercurial 维基
- 认识 Mercurial |Peepcode 截屏视频
- 掌握 Mercurial |TekPub 截屏视频
- Hg Init - Mercurial 入门教程
- Mercurial: The Definitive Guide
- Mercurial Wiki
- Meet Mercurial | Peepcode Screencast
- Mastering Mercurial | TekPub Screencast
- Hg Init - ground-up Mercurial tutorial
推荐答案
如何配置忽略文件?
Ignore 配置在存储库根目录中名为 .hgignore 的普通文本文件中.像普通文件一样添加它:
How do you configure it to ignore files?
Ignore is configured in a normal text file called .hgignore in the root of your repository. Add it just like a normal file with:
hg add .hgignore
有两种语法选项可用于文件匹配,glob 和 regexp.glob 是类 unix 的文件名扩展,regexp 是正则表达式.您可以通过在一行上单独添加 syntax: glob
或 syntax: regexp
来激活每个.接下来的所有行都将使用该语法,直到下一个语法标记.您可以根据需要拥有任意数量的语法标记.默认语法是 regexp,因此如果您只使用 regexp,则不需要任何语法标记.
There are two syntax options available for file matching, glob and regexp. glob is unix-like filename expansion and regexp is regular expressions. You activate each by adding syntax: glob
or syntax: regexp
on a line by itself. All lines following that will use that syntax, until the next syntax marker. You can have as many syntax markers as you want. The default syntax is regexp, so if you only use regexp you don't need any syntax marker.
你可以用#添加评论
示例:
# python temporary files
syntax: glob
*.pyc
#editor autosaves
*~
# temporary data
syntax: regexp
temp
忽略仅适用于非托管文件(即尚未签入的文件).要忽略受版本控制的文件,您可以使用开关 -I 和 -X.
Ignore only applies to unmanaged files (i.e. files that are not already checked in). To ignore files that are under version control, you can use the switches -I and -X.
这篇关于Mercurial 初学者:权威实用指南的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!