Git、Mercurial、SVN
可能的重复:
对于家庭项目, Mercurial 或 Git(或其他 DVCS)能否比 Subversion 提供更多优势?
相对优势和劣势是什么Git、Mercurial 和 Bazaar?
这些源代码控制系统之间有哪些区别?哪一个最适合 2 人小型项目?
Possible Duplicates:
For home projects, can Mercurial or Git (or other DVCS) provide more advantages over Subversion?
What are the relative strengths and weaknesses of Git, Mercurial, and Bazaar?
What are some of the differences between these source control system? Which one is the best for a small 2 people project?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
首先,是它们编写的语言。我使用 Git 和 Mercurial 的经历非常相似,但我知道如果我想调整 Mercurial,我可以做到,因为它是用 Python 编写的。 Git 至少在某种程度上是用 C 语言编写的,而我对 C 语言不太熟悉。
Git 和 Mercurial 就是所谓的分布式。每个副本都是平等创建的,并且它们可以临时推送和拉动(使用该术语)彼此之间的更改。另一方面,Subversion 由一个中央存储库组成,每个工作副本都是该中央服务器的从属服务器,从它单独推送和拉取(在本例中是提交和更新)更改。
为几个人安装 Git 或 Mercurial 包括通过 SSH 访问同一台服务器并安装几个软件包。而对于 SVN,据我所知,您需要在 Apache 下配置和运行实际的服务器应用程序,然后使用 SSL 证书和 .htaccess 等来保护它。
对于我所有的个人项目,我都会使用 Mercurial 或 Git。如果我与一个大型团队合作,我可能会使用 Subversion,因为你可以获得集中式身份验证和托管。但对于两个人来说,我会选择分布式之一,因为这样你就不必搞乱集中式身份验证和托管。 :-)
To start with, there's the language they're written in. My experiences with Git and Mercurial have been very similar, but I know that if I want to tweak Mercurial, I can do it, because it's written in Python. Git is at least somewhat in C, which I'm not as familiar with.
Git and Mercurial are what's called distributed. Every copy is created equal, and they can push and pull (using that terminology) changes from each other on an ad-hoc basis. Subversion, on the other hand, consists of a single central repository, and each working copy is a slave to that central server, pushing and pulling (committing and updating, in this case) changes from it and it alone.
Installing Git or Mercurial for a couple of people consists of getting SSH access to the same server and installing a couple of packages. Whereas for SVN, as far as I know you need to configure and run an actual server application under Apache, and then mess with an SSL cert and .htaccess, etc. to secure it.
For all my personal projects, I go with Mercurial or Git. If I were working with a large team, I'd probably go Subversion because you get centralized authentication and hosting. But for two people, I'd pick one of the distributed ones, because then you don't have to mess with centralized authentication and hosting. :-)
Git 和 Mercurial 非常相似(但不同之处足以值得谨慎对待)。另一方面,SVN 则完全不同:前两者是分布式 VCS,因此它们不需要中央服务器,而 SVN 则需要。一般来说,许多项目正在转向分布式系统。
对于小型项目,使用 Git 或 Mercurial 可能会更好。你选择哪一个本质上是一个品味问题,尽管我自己更喜欢 Git(并且对它更加熟悉)。您根本不需要设置服务器:您可以通过 SSH 推送/拉取更改,甚至可以通过电子邮件互相发送补丁(这可以直接从 VCS 完成,但有点麻烦)。您可以随时设置中央服务器,所有更改都将在那里。您可以使用 GitHub 或 Gitorious 等来托管您的项目(如果您使用 Git,我不知道 Mercurial)。
Git and Mercurial are quite similar (but different enough to warrant caution). SVN on the other hand is quite different: the first two are distributed VCSs, so they do not require a central server, while SVN does. In general many projects are moving toward distributed systems.
For your small project, you're probably better off with Git or Mercurial. Which one you choose is essentially a matter of taste, although I prefer Git myself (and am far more familiar with it). You need not set up a server at all: you can push/pull changes through SSH or even email patches to each other (this can be done directly from the VCS but is sort of a hassle). You can set up a central server at any time, and all the changes will be there. You can use e.g. GitHub or Gitorious to host your project (if you're going with Git, I don't know about Mercurial).
SVN 与 Git 和 Mercurial 不同,因为它是所有用户都必须拉取和提交的单个存储库。
Git 和 Mercurial 有分布式模型。这意味着每台计算机上都有一个存储库,并且通常有一个“官方”存储库,人们会选择将更改提交到其中并从中提取更改。
Git 和 Mercurial 非常相似。我更喜欢 Mercurial,因为我发现它更容易使用。对于 2 人团队,我会推荐 Mercurial,但这只是我的意见。如果您不熟悉版本控制,那么您仍然需要花时间学习使用任何选项,但 Mercurial 对我来说似乎是最简单的。
要启动 Mercurial 存储库,您只需打开 shell 并 cd 到您想要进行版本控制的目录,然后输入
hg init
。这将创建存储库。要将文件夹中的所有内容添加到存储库,请输入hg add .
。以下是其他一些不同的命令:hg commit -m "Descriptions of Changes"
hg pull
hg Push
SVN is different from Git and Mercurial, in that it is a single repository that all users have to pull and commit to.
Git and Mercurial have a distributed model. This means that there is a repository on every computer and there is usually an "Official" repository that people will choose to commit their changes to and pull from.
Git and Mercurial are extremely similar. I prefer Mercurial because I found it much easier to use. For a 2 person team I would recommend Mercurial, but that is just my opinion. If you are not familiar with version control then you are still gonna have to spend your time learning to use any of the options, but Mercurial seemed the easiest for me.
To start a Mercurial repository all you have to do is open a shell and cd to the directory you want to have version control in, and type
hg init
. That creates the repository. To add everything in the folder to the repository, typehg add .
. Here are some other various commands:hg commit -m "Descriptions of changes"
hg pull
hg push