.NET 开发人员的 Git 与 Mercurial?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1496423/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Git versus Mercurial for .NET developers?
提问by jwanagel
I've been wondering what is the better DVCS for .NET developers? From reading various information it has sounded like Mercurial works better on Windows, but other information claims that Git has caught up and surpassed Mercurial in offering quality Windows and Visual Studio tools. Does anyone have good recent information or experience with trying both in a .NET development environment?
我一直在想,对于 .NET 开发人员来说,什么是更好的 DVCS?通过阅读各种信息,听起来 Mercurial 在 Windows 上运行得更好,但其他信息声称 Git 在提供高质量的 Windows 和 Visual Studio 工具方面已经赶上并超越了 Mercurial。有没有人有在 .NET 开发环境中尝试这两种方法的最新信息或经验?
采纳答案by Kurt Schelfthout
I have been using Mercurial for over a year now for doing .NET development, and it has been working out great. I do admit I don't use any of the fancy tools (explorer add-ons and Visual studio tools), but they are available (e.g. TortoiseHg). I have found that using the command line tools is just as easy - just specify a few wildcards in .hgignore (as in Blaenk's answer) and you're good to go.
我已经使用 Mercurial 进行 .NET 开发一年多了,而且效果很好。我承认我不使用任何花哨的工具(资源管理器附加组件和 Visual Studio 工具),但它们是可用的(例如 TortoiseHg)。我发现使用命令行工具同样简单 - 只需在 .hgignore 中指定几个通配符(如Blaenk 的回答),您就可以开始使用了。
I'm not sure how well git integrates with hg, but for the reverse siutation I have used hg-gitin the past and it worked fine. It is however still somewhat unstable as new releases of hg come out.
我不确定 git 与 hg 的集成情况如何,但对于反向定位,我过去使用过hg-git并且效果很好。然而,随着新版本的 hg 的出现,它仍然有些不稳定。
So you should be able to use github from mercurial, and for native mercurial repos there is always the (imo) equally nice bitbucket.org. Edit: Note also that codeplex, which is focused on .NET open source projects, now offers Git and Mercurial repositories.
因此,您应该能够使用来自 mercurial 的 github,并且对于本机 mercurial 存储库,总是有(imo)同样不错的bitbucket.org。编辑:另请注意,专注于 .NET 开源项目的codeplex现在提供 Git 和 Mercurial 存储库。
And I should mention that "popularity" is a very difficult criterion to base your choice on. Either DVCS has high-profile users. Git has the linux kernel, of course, while notable hg users include the mozilla and Python projects.
而且我应该提到,“受欢迎程度”是您选择的一个非常困难的标准。DVCS 都拥有高知名度的用户。当然,Git 有 linux 内核,而著名的 hg 用户包括 mozilla 和 Python 项目。
EDIT: Since this seems to get regular upvotes. Everything I wrote above was true at the time of writing, but I no longer agree with my former self bitbucket is as nice as GitHub. GitHub has better functionality, and from my point of view (mostly F# open source development) everyone else is there so you get much better network effects. I moved all my project from codeplex/bitbucket to GitHub a while ago and immediately started getting contributions, whereas on codeplex/bitbucket next to nothing happened.
编辑:因为这似乎得到了定期的赞成。我上面写的所有内容在撰写本文时都是真实的,但我不再同意我以前的自我 bitbucket 和 GitHub 一样好。GitHub 具有更好的功能,从我的角度来看(主要是 F# 开源开发),其他所有人都在那里,因此您可以获得更好的网络效果。不久前,我将我所有的项目从 codeplex/bitbucket 移到了 GitHub,并立即开始获得贡献,而在 codeplex/bitbucket 上几乎什么也没发生。
回答by Jorge Israel Pe?a
I think that given git's exponential popularity growth, git's good support for windows (akin to that of subversion's with something like tortoiseSVN) is bound to arrive, it is only a matter of time. The two projects that seem to be the most popular are msysgit, and TortoiseGit(also uses msysgit) which is similar to tortoiseSVN. git keeps becoming more and more popular, that if you were to run into any problems which is unlikely now and is becoming even more unlikely as git tools on windows become further developed, you will be able to find fixes a lot easier due to the large userbase.
我认为,鉴于 git 的指数式流行增长,git 对 windows 的良好支持(类似于 subversion 的支持,例如 tortoiseSVN)一定会到来,这只是时间问题。似乎最受欢迎的两个项目是msysgit和TortoiseGit(也使用 msysgit),它类似于 tortoiseSVN。git 变得越来越流行,如果你遇到任何现在不太可能出现的问题,并且随着 Windows 上的 git 工具的进一步发展变得越来越不可能,你将能够更容易地找到修复程序,因为它很大用户群。
In the meantime, I have found this seriesof guides to be very helpful.
与此同时,我发现这一系列指南非常有帮助。
Issues you might run into may be ignoring certain files, which should be easy if you lookup how to use .gitignore
, which is really straightforward, here is the list of files and wildcards that the series mentions:
您可能遇到的问题可能是忽略某些文件,如果您查找如何使用 ,这应该很容易.gitignore
,这非常简单,这是该系列提到的文件和通配符列表:
obj
bin
_ReSharper.*
*.csproj.user
*.resharper.user
*.resharper
*.suo
*.cache
*~
*.swp
Also I have seen some issues regarding line endings. For that, you will want to check out this question.
我也看到了一些关于行尾的问题。为此,您将需要查看此问题。
回答by Spoike
At the time of writing, I've used both TortoiseGitand TortoiseHg(for mercurial) in different projects, dominantly java and .net projects. I have to say that TortoiseHg is in the lead as it is much more stable and fully featured of the two.
在撰写本文时,我在不同的项目中使用了TortoiseGit和TortoiseHg(用于 mercurial),主要是 java 和 .net 项目。我不得不说 TortoiseHg 处于领先地位,因为它更稳定且功能齐全。
There is a Mercurial plugin for Visual Studio 2008, but I'd suggest sticking with TortoiseHg until the plugin itself is stable. Not sure about integration with git, but there is some talk about a plugin for VS here.
Visual Studio 2008有一个 Mercurial插件,但我建议坚持使用 TortoiseHg,直到插件本身稳定为止。不知道用git的整合,但有一些谈了VS插件这里。
回答by jimmy2pinz
Although git is a natural draw for unix/linux users, it has been getting better for windows and .net users. mercurial however, may be a better choice between the two. unlike centralized dev, where there's a plethora of choices, there are very few "true" dvcs tools out there. as far as i know, there's only one commercial system, plastic scm and the two aforementioned oss tools. i have come from the clearcase side and have experience with pvcs, p4 and other traditional scm tools. i tripped upon plastic, maybe through this site and from what i have evaluated, seems to do well from a visual standpoint. if you're more of a windows shop as you say, it may be plastic, mercurial, and git in that order. if you're more unix/linux, git is probably the first logical choice. hope this helps!
尽管 git 对 unix/linux 用户很自然,但它对 windows 和 .net 用户来说已经变得更好了。然而,mercurial 可能是两者之间更好的选择。与有大量选择的集中式开发不同,很少有“真正的”dvcs 工具。据我所知,只有一个商业系统,塑料scm和前面提到的两个oss工具。我来自 clearcase 方面并且有使用 pvcs、p4 和其他传统 scm 工具的经验。我被塑料绊倒了,也许是通过这个网站,从我的评估来看,从视觉的角度来看,它似乎做得很好。如果您像您所说的那样更像是一家橱窗商店,那么它可能按顺序是塑料、水银和 git。如果你更喜欢 unix/linux,git 可能是第一个合乎逻辑的选择。希望这可以帮助!
回答by pablo
Both Git and Mercurial will do fine for a .NET developer, but it's well-known that Mercurial has better Windows support. Also, if you consider a commercial tool, why don't you take a look at Plastic SCM reading the following tutorial on distributed dev on Windows? http://codicesoftware.blogspot.com/2010/03/distributed-development-for-windows.htmlUpdateNow Plastic SCM has a FREE Community Edition.
Git 和 Mercurial 都适合 .NET 开发人员,但众所周知,Mercurial 具有更好的 Windows 支持。此外,如果您考虑使用商业工具,为什么不看看 Plastic SCM,阅读以下有关 Windows 分布式开发的教程?http://codicesoftware.blogspot.com/2010/03/distributed-development-for-windows.html立即更新Plastic SCM 有一个免费的社区版。
回答by Stuart Ellis
I haven't used Mercurial seriously, but have just finished switching to Git from Subversion for .NET development. The distribution that I'm using is Git Extensions, which install the standard (msys) Git, plus a graphical frontend, some Windows Explorer integration, and a Visual Studio plugin. It also ships with good docs. The Explorer integration doesn't provide the neat status markers on file icons that TortoiseSVN does, but just adds the essentials to the right-click menu. All of these tools are working fine.
我没有认真使用 Mercurial,但刚刚完成从 Subversion 切换到 Git 进行 .NET 开发。我使用的发行版是Git Extensions,它安装标准 (msys) Git、图形前端、一些 Windows 资源管理器集成和 Visual Studio 插件。它还附带了很好的文档。Explorer 集成并没有像 TortoiseSVN 那样在文件图标上提供整洁的状态标记,而只是将基本要素添加到右键单击菜单中。所有这些工具都运行良好。
The biggest issue I've found is that Git requires you to understand the concepts to get good results. The graphical interfaces of Git Extensions are just thin shells over the Git facilities, so if you struggle with, say, submodules, then none of the tools provided by Git Extensions will solve that problem. There are now loads of tutorials and videos about Git online, though.
我发现的最大问题是 Git 要求你理解概念才能获得好的结果。Git Extensions 的图形界面只是 Git 工具的薄壳,因此,如果您遇到子模块等问题,那么 Git Extensions 提供的任何工具都无法解决该问题。不过,现在网上有大量关于 Git 的教程和视频。
By default Windows builds of Git convert line endings to CRLF; as we are completely an MS shop this is the right behavior for us.
默认情况下,Git 的 Windows 版本将行尾转换为 CRLF;因为我们完全是一家 MS 商店,所以这对我们来说是正确的行为。
回答by Kariem Abd El-Fattah
Git has a major advantage that will make life easier while using VS, the rename detection, if you want to just use Command Line interface, In HG you have to rename the files when you rename it in VS, in Git will detect your renames seamlessly (it tracks contents not files), even you do some changes in the file it will detect the rename as well.
Git 有一个主要优势,可以使使用 VS 时的生活更轻松,重命名检测,如果您只想使用命令行界面,在 HG 中您必须在 VS 中重命名文件时重命名文件,在 Git 中将无缝检测您的重命名(它跟踪内容而不是文件),即使您对文件进行了一些更改,它也会检测到重命名。