初学者Mercurial:权威的实用指南 [英] Mercurial for Beginners: The Definitive Practical Guide

查看:77
本文介绍了初学者Mercurial:权威的实用指南的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

灵感来自面向初学者的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
  • 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.

问题:

  • How to install Mercurial?
  • How to set up Mercurial?
  • How do you create a new project/repository?
  • How do you configure it to ignore files?
  • How do you get the latest code?
  • How do you check out code?
  • How do you commit changes?
  • How do you see what's uncommitted, or the status of your current codebase?
  • How do you remove files from the repository?
  • How do you destroy unwanted commits?
  • How do you compare two revisions of a file, or your current file and a previous revision?
  • How do you see the history of revisions to a file or repository?
  • How do you handle binary files (visio docs, for instance, or compiler environments)?
  • How do you merge files changed at the "same time"?
  • How do you revert a Changeset?
  • How do you go back to a previous version of the code?
  • How do you extract a patch from a specific changeset?
  • How do you record that you renamed or deleted a file without using the Mercurial command?
  • How do you 'mark' 'tag' or 'release' a particular set of revisions for a particular set of files so you can always pull that one later?
  • How do you pull a particular 'release'?
  • How do you branch?
  • How do you merge branches?
  • How do you merge parts of one branch into another branch?
  • Good GUI/IDE plugin for Mercurial? Advantages/disadvantages?
  • Any other common tasks a beginner should know?
  • How do I interface with Subversion?
  • Mercurial: The Definitive Guide
  • Mercurial Wiki
  • Meet Mercurial | Peepcode Screencast
  • Mastering Mercurial | TekPub Screencast
  • Hg Init - ground-up Mercurial tutorial

推荐答案

如何配置它以忽略文件?

忽略是在存储库根目录中的普通文本文件.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: globsyntax: 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆