问题
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?
回答1:
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.
I'm not sure how well git integrates with hg, but for the reverse siutation I have used hg-git in the past and it worked fine. It is however still somewhat unstable as new releases of hg come out.
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.
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.
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.
回答2:
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.
In the meantime, I have found this series of 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:
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.
回答3:
At the time of writing, I've used both TortoiseGit and 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.
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.
回答4:
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!
回答5:
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.html Update Now Plastic SCM has a FREE Community Edition.
回答6:
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.
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.
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.
回答7:
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.
来源:https://stackoverflow.com/questions/1496423/git-versus-mercurial-for-net-developers