git - गिट और मर्कुरियल-तुलना और तुलना करें
version-control mercurial (8)
मुझे लगता है कि आप उन दो वीडियो को झुकाकर उन प्रणालियों के समान या अलग होने की भावना महसूस कर सकते हैं:
उनमें से दोनों डिजाइन में बहुत समान हैं लेकिन कार्यान्वयन में बहुत अलग हैं।
मैं Mercurial का उपयोग करें। जहां तक मैं गिट को समझता हूं, एक प्रमुख बात गिट अलग है कि यह फाइलों की बजाय फ़ाइलों की सामग्री को ट्रैक करता है। लिनस का कहना है कि यदि आप एक फ़ाइल से दूसरे फाइल में फ़ंक्शन ले जाते हैं, तो गिट आपको उस एकल फ़ंक्शन का इतिहास बताएगा।
वे यह भी कहते हैं कि गिट HTTP पर धीमा है लेकिन इसका अपना नेटवर्क प्रोटोकॉल और सर्वर है।
गिट Mercurial की तुलना में एक एसवीएन मोटी ग्राहक के रूप में बेहतर काम करता है। आप एक एसवीएन सर्वर के खिलाफ खींच और धक्का दे सकते हैं। यह कार्यक्षमता अभी भी Mercurial में विकास के तहत है
Mercurial और Git दोनों में बहुत अच्छे वेब होस्टिंग समाधान उपलब्ध हैं (बिटबकेट और गिटहब), लेकिन Google Code केवल Mercurial का समर्थन करता है। वैसे, उनके पास Mercurial और Git की एक विस्तृत विस्तृत तुलना है जो उन्होंने तय करने के लिए किया था कि कौन सा समर्थन करेगा ( http://code.google.com/p/support/wiki/DVCSAnalysis )। इसमें बहुत अच्छी जानकारी है।
थोड़ी देर के लिए मैं अपनी निजी परियोजनाओं के लिए विचलन का उपयोग कर रहा हूं।
अधिक से अधिक मैं गिट और मर्कुरियल, और सामान्य रूप से डीवीसीएस के बारे में महान चीजें सुनता रहता हूं।
मैं पूरी डीवीसीएस चीज को एक भंवर देना चाहता हूं, लेकिन मैं किसी भी विकल्प से ज्यादा परिचित नहीं हूं।
Mercurial और गिट के बीच कुछ अंतर क्या हैं?
ध्यान दें कि मैं यह जानने की कोशिश नहीं कर रहा हूं कि कौन सा "सर्वश्रेष्ठ" है या यहां तक कि मुझे किसके साथ शुरुआत करनी चाहिए। मैं मुख्य रूप से प्रमुख क्षेत्रों की तलाश में हूं जहां वे समान हैं और जहां वे अलग हैं, क्योंकि मुझे यह जानने में दिलचस्पी है कि वे कार्यान्वयन और दर्शन के संदर्भ में कैसे भिन्न होते हैं।
मैंने कुछ समय पहले मर्कुरियल के ब्रांचिंग मॉडल के बारे में एक ब्लॉग एंट्री लिखी थी, और इसमें गिट के ब्रांचिंग मॉडल की तुलना शामिल थी। शायद आपको यह दिलचस्प लगेगा: stevelosh.com/blog/entry/2009/8/30/…
After reading all over that Mercurial is easier (which I still believe it is, after all the internet community is of the opinion), when I started working with Git and Mercurial I felt Git is relatively simpler for me to adapt to (I started off with Mercurial with TortoiseHg) when working from the command line, mainly because the git commands were named appropriately according to me and are fewer in number. Mercurial has different naming for each command that does a distinct job, while Git commands can be multipurpose according to situation (for eg,
checkout ). While Git was harder back then, now the difference is hardly substantial. YMMV.. With a good GUI client like TortoiseHg, true it was much easier to work with Mercurial and I did not have to remember the slightly confusing commands. I'm not going into detail how every command for the same action varied, but here are two comprehensive lists: 1 from Mercurial's own site and 2nd from wikivs .
╔═════════════════════════════╦════════════════════════════════════════════════════════════════════════════════════════════════╗ ║ Git ║ Mercurial ║ ╠═════════════════════════════╬════════════════════════════════════════════════════════════════════════════════════════════════╣ ║ git pull ║ hg pull -u ║ ║ git fetch ║ hg pull ║ ║ git reset --hard ║ hg up -C ║ ║ git revert <commit> ║ hg backout <cset> ║ ║ git add <new_file> ║ hg add <new_file> (Only equivalent when <new_file> is not tracked.) ║ ║ git add <file> ║ Not necessary in Mercurial. ║ ║ git add -i ║ hg record ║ ║ git commit -a ║ hg commit ║ ║ git commit --amend ║ hg commit --amend ║ ║ git blame ║ hg blame or hg annotate ║ ║ git blame -C ║ (closest equivalent): hg grep --all ║ ║ git bisect ║ hg bisect ║ ║ git rebase --interactive ║ hg histedit <base cset> (Requires the HisteditExtension.) ║ ║ git stash ║ hg shelve (Requires the ShelveExtension or the AtticExtension.) ║ ║ git merge ║ hg merge ║ ║ git cherry-pick <commit> ║ hg graft <cset> ║ ║ git rebase <upstream> ║ hg rebase -d <cset> (Requires the RebaseExtension.) ║ ║ git format-patch <commits> ║ hg email -r <csets> (Requires the PatchbombExtension.) ║ ║ and git send-mail ║ ║ ║ git am <mbox> ║ hg mimport -m <mbox> (Requires the MboxExtension and the MqExtension. Imports patches to mq.) ║ ║ git checkout HEAD ║ hg update ║ ║ git log -n ║ hg log --limit n ║ ║ git push ║ hg push ║ ╚═════════════════════════════╩════════════════════════════════════════════════════════════════════════════════════════════════╝
Git saves a record of every version of committed files internally, while Hg saves just the changesets which can have a smaller footprint. Git makes it easier to change the history compared to Hg, but then again its a hate-it-or-love-it feature. I like Hg for former and Git for latter.
What I miss in Hg is the submodule feature of Git. Hg has subrepos but that's not exactly Git submodule.
Ecosystem around the two can also influence one's choice: Git has to be more popular (but that's trivial), Git has GitHub while Mercurial has BitBucket , Mercurial has TortoiseHg for which I haven't seen an equivalent as good for Git.
Each has its advantages and disadvantages, with either of them you're not going to lose.
Check out Scott Chacon's post from a while back.
I think git has a reputation for being "more complicated", though in my experience it's not more complicated than it needs to be. IMO, the git model is way easier to understand (tags contain commits (and pointers to zero or more parent commits) contain trees contain blobs and other trees... done).
It's not just my experience that git is not more confusing than mercurial. I'd recommend again reading this blog post from Scott Chacon on the matter.
I've used Git for a little over a year at my present job, and prior to that, used Mercurial for a little over a year at my previous job. I'm going to provide an evaluation from a user's perspective.
First, both are distributed version control systems. Distributed version control systems require a change in mindset from traditional version control systems, but actually work much better in many ways once one understands them. For this reason, I consider both Git and Mercurial much superior to Subversion, Perforce, etc. The difference between distributed version control systems and traditional version control systems is much larger than the difference between Git and Mercurial.
However, there are also significant differences between Git and Mercurial that make each better suited to its own subset of use cases.
Mercurial is simpler to learn. I got to the point where I rarely had to refer to documentation or notes after a few weeks of using Mercurial; I still have to refer to my notes regularly with Git, even after using it for a year. Git is considerably more complicated.
This is partly because Mercurial is just plain cleaner. You rarely have to branch manually in Mercurial; Mercurial will create an anonymous branch automatically for you if and when you need it. Mercurial nomenclature is more intuitive; you don't have to worry about the difference between "fetch" and "pull" as you do with Git. Mercurial is a bit less buggy. There are file name case sensitivity issues that used to cause problems when pushing projects across platforms with both Git and Mercurial; this were fixed in Mercurial some time ago while they hadn't been fixed in Git last I checked. You can tell Mercurial about file renames; with Git, if it doesn't detect the rename automatically - a very hit or miss proposition in my experience - the rename can't be tracked at all.
The other reason for Git's additional complication, however, is that much of it is needed to support additional features and power. Yes, it's more complicated to handle branching in Git - but on the other hand, once you have the branches, it's not too difficult to do things with those branches that are virtually impossible in Mercurial. Rebasing branches is one of these things: you can move your branch so that its base, instead of being the state of the trunk when you branched, is the state of the trunk now; this greatly simplifies version history when there are many people working on the same code base, since each of the pushes to trunk can be made to appear sequential, rather than intertwined. Similarly, it's much easier to collapse multiple commits on your branch into a single commit, which can again help in keeping the version control history clean: ideally, all the work on a feature can appear as a single commit in trunk, replacing all the minor commits and subbranches that the developer may have made while developing the feature.
Ultimately I think the choice between Mercurial and Git should depend on how large your version control projects are, measured in terms of the number of people working on them simultaneously. If you have a group of a dozen or more working on a single monolithic web application, for example, Git's more powerful branch management tools will make it a much better fit for your project. On the other hand, if your team is developing a heterogeneous distributed system, with only one or two developers working on any one component at any one time, using a Mercurial repository for each of the component projects will allow development to proceed more smoothly with less repository management overhead.
Bottom line: if you have a big team developing a single huge application, use Git; if your individual applications are small, with any scale coming from the number rather than the size of such applications, use Mercurial.
If you need good Windows support, you might prefer Mercurial. TortoiseHg (Windows explorer plugin) manages to offer a simple to use graphical interface to a rather complex tool. As state here, you will also have a Visual Studio plugin . However, last time I tried, the SVN interface didn't work that well on Windows.
If you don't mind the command line interface, I would recommend Git. Not for technical reason but for a strategical one. The adoption rate of git is much higher. Just see how many famous open source projects are switching from cvs/svn to Mercurial and how many are switching to Git. See how many code/project hosting providers you can find with git support compared to Mercurial hosting.
One difference totally unrelated to the DVCSs themselves:
Git seems to be very popular with C developers. Git is the de-facto repository for the Linux Kernel and this may be the reason why it is so popular with C developers. This is especially true for those that have the luxury of only working in the Linux/Unix world.
Java developers seem to favor Mercurial over Git. There are possibly two reasons for that: One is that a number of very large Java projects are hosted on Mercurial, including the JDK itself. Another is that the structure and clean documentation of Mercurial appeals to people coming from the Java camp whereas such people find Git inconsistent wrt command naming and lacking in documentation. I'm not saying that is actually true, I'm saying people have got used to something from their usual habitat and then they tend to choose DVCS from that.
Python developers almost exclusively favor Mercurial, I would assume. There's actually no rational reason for that other than the fact that Mercurial is based on Python. (I use Mercurial too and I really don't understand why people make a fuss about the implementation language of the DVCS. I don't understand a word of Python and if it wasn't for the fact that it is listed somewhere that it is based on Python then I wouldn't have known).
I don't think you can say that one DVCS fits a language better than another, so you shouldn't choose from that. But in reality people choose (partly) based on which DVCS they get most exposed to as part of their community.
(nope, I don't have usage statistics to back up my claims above .. it is all based on my own subjectivity)
Take a look at Git vs. Mercurial: Please Relax blog post by Patrick Thomson, where he writes:
Git is MacGyver , Mercurial is James Bond
Note that this blog post is from August 7, 2008, and both SCM improved much since.