For home projects, does Mercurial or Git (or other DVCS) provide more advantages over Subversion?

Which free source code management system is most preferable considering home projects and documents?

I am thinking of using Subversion (as I am familiar with it).

Home project feature:

  • Most likely, one person will make changes. (Maybe one day (not now), it is possible that I am sharing a project with my friend who is in another city)

  • I would like to save other documents (files without programming)

Is Mercurial or GIT (Distributed Version Management System) able to give me more advantages over subversion in Home Projects?

+28
git version-control svn mercurial
Aug 2 '09 at 8:55
source share
9 answers

Take a look at the one-developer versioning part of the answer to the question “ Difference between GIT and CVS ” in StackOverflow. Some of these problems still apply to Subversion compared to GIT (or other distributed VCS: Mercurial, Bazaar or less well-known: Monotone , Darcs), even if Subversion is an improvement over CVS.

DISCLAIMER: I use GIT (therefore I am biased) and I know Subversion only from the documentation (and other resources), never using it myself. Perhaps I am mistaken in the capabilities of Subversion.

The following is a list of the differences between GIT over Subversion for a single developer on the same machine (separate account):

  • Storage setup. GIT stores the repository in the .git directory in the top directory of your project. Starting a new project from an unversioned file tree is as simple as making "git init" in the top directory of your project (and then, of course, "git add."), To add files and, for example, "git commit -m 'Initial commit '' to create the first commit).

    In Subversion (in any centralized version control system) you need to set up a central repository (if you haven’t done this before) using "svnadmin create" (well, you only need to do this once). Then you need to import the files into Subversion using "svn import" (or "svn add") ... But note that after the import is complete, the original tree will not be converted to a working copy. To get started, you still need to “svn checkout” create a new working copy of the tree.

  • Repository and repository metadata. GIT stores both the repository (i.e. information about changes and branches, etc.) and the repository metadata (for example, your identity, a list of ignored files, which branch is currently being checked) in the .git directory in your top directory projects.

    Subversion stores the repository in a separate area that you have to put for this purpose and saves the repository metadata (for example, where is the central repository, the identifier used to access the central repository, and I also think that properties like svn:ignore ), stored in .svn in the directory of each directory of your project. (Note that Subversion keeps a blank copy of your order in order to have "svn status" and "svn diff")

  • Naming versions / version numbers. Subversion uses global revision identifiers in a single version with a number, so you can, for example, refer to r344, revision 344). Subversion also supports several symbolic revision specifications: HEAD, BASE, COMITTED, PREV.

    In GIT, each version of the project (each commit) has its own unique name given by 40 hexdigits SHA-1 id; Usually, the first 7-8 characters are sufficient to identify a fix (you cannot use a simple numbering scheme for versions in a distributed version control system, which requires a central authority on numbering). But GIT also offers other types of revision specifications, for example, HEAD^ means the parent element of the current commit, master~5 means 5 ancestors back (in the direct line of the first parent) back from the top commit to the leading branches, v1.6.3-rc2 can mean a revision tagged with v1.6.3-rc2 .

    See also Many different revision qualifiers on Elijah Newren's blog.

  • Easy forking and merging. In GIT, creating and merging branches is very simple; GIT remembers all the necessary information on its own (therefore, merging a branch occurs in the same way as "git merge branchname") ... it should have been because distributed development naturally leads to several branches. GIT uses a heuristic definition of renaming based on affinity, so when merging it can deal with the case where one side renamed a file (and other similar cases related to renaming). This means that you can use the thread branch workflow, i.e. Create a separate function in several steps in a separate function branch.

    Branches have an unusual implementation in Subversion; they are processed by the naming convention: a branch is a combination of revisions in the global repository that exist in a particular namespace. A new branch is created by copying an existing set of files from one namespace to another, recorded as the revision itself. Subversion made it easier to create a new branch ... but prior to version 1.5, you had to use additional tools like SVK or svnmerge so that they could merge easily. Subversion 1.5 introduces the svn:mergeinfo , but even then merging is a bit more complicated than in Git; you also need to use additional options to display and use merge tracking information in tools like svn log and svn wame. I heard that it does not work correctly in more complex situations (criss-cross merge) and cannot rename it now (in this case there is even the possibility of silent corruption). See Also (for example) this post on Dmitry Potapov’s GIT mailing list , explaining the alleged use case for svn:mergeinfo and its (current) limitations.

  • Mark. The GIT tags are immutable , can have a comment associated with them and can be signed using the PGP / GPG signature (and verified). They are created using the git tag. You can reference a revision using a tag name.

    Subversion tags use the same path_info namespace as branches (recommended convention svnroot/project/tags/tagname ), and they are not protected from change. They are created using "svn copy". They may have a comment associated with the [commit creating the tag].

  • Keyword expansion. GIT offers a very, very limited set of keywords compared to Subversion (the default). This is due to two facts: changes in GIT for each repository, not for the file, and GIT avoids modifying files that did not change when switching to another branch or renaming to another point in the history. If you want to insert the version number using Git, you must do this using your build system, for example. following the exaple GIT -VERSION-GEN script in Linux kernel sources and in GIT sources. There is also an 'ident' gitattribute that allows you to expand the $ Id $ keyword to the SHA-1 identifier of the file contents (not the commit identifier).

    Both GIT and Subversion do keyword expansion only on demand.

  • Binary files Both GIT and Subversion handle binary files correctly. GIT binary detection using a similar algorithm used, for example, by GNU diff, unless overridden based on each route using gitattributes. Subversion does this a bit differently by detecting the file type while adding the file and setting the svn:mime-type property, which you can then change. Both GIT and Subversion can do character-string conversion on demand; GIT additionally has the option core.safecrlf config, which prevents and prevents irreversible changes (all CRs for all CRLFs are reversible, mixed CRs and CRLFs are not reversible).

  • Ignoring files. GIT saves ignore patterns using the in-tree .gitignore , which can be installed under version control and distributed; it usually contains templates for build products and other generated files and in the .git/info/excludes , which usually contains ignore patterns specific to the user or system, for example. ignore pattersn for your editor backup files. GIT templates are applied recursively, unless patter contains a directory delimiter, that is, a slash character '/', then it is bound to the .gitignore file directory; to the top directory for .git/info/excludes . (There is also a configuration variable core.excludesfile , this variable can exist in the configuration file for the user ~/.gitconfig and point to the ignore file for each user).

    Subversion uses the global-ignores configuration option (which usually applies to a specific computer or a specific computer user) and the " svn:ignore " property in directories with the SVN version. However, unlike the global-ignores (and in .gitignore ), the templates found in the " svn:ignore " property only apply to the directory in which this property is set, and not to any of its subdirectories. In addition, Subversion does not recognize the use of the prefix ! for a template as an exception mechanism.

  • Change commits. distributed VCS, such as publishing a GIT publication, does not depend on creating a commit; you can change (edit, rewrite) an unpublished part of the story without inconvenience to other users. In particular, if you notice a typo (or other error) in the commit message or an error in the commit, you can simply use "git commit -amend". (Note: technically, this is a re-creation of a commit, not a change to an existing commit, the modified commit has a different identifier).

    Subversion only allows you to modify the commit message after the fact by changing the corresponding property.

  • Instruments. On the one hand, GIT offers a richer set of commands. One of the most important is git bisect, which can be used to detect the commit (revision) that introduced the error; if your commits are small and standalone, it should be pretty easy to spot where the error is.

    Subversion, on the other hand, because it exists longer, may have a wider range of third-party tools and Subversion support in tools than Git. Or at least more mature. Especially in MS Windows.




And there is one more problem that can be very important later:

  • Publishing a repository. If (when?) At some point you want to share your repository, turning it from a project with one person, developed on one home computer, to contribute to something else, with GIT is as simple as creating an empty repository on the server or on one of the existing GIT sites for hosting / hosting software with GIT support (for example, http://repo.or.cz , GitHub , Gitorious , InDefero; more - also for other DVCS - are indicated in which it answers ), and then laying out the project in this public repository.

    I think this is harder with Subversion, unless you start with a Subversion-enabled hosting site (such as SourceForge) from the very beginning, unless you want to keep an existing change history. On the other hand, for example, Google Code suggests using the svnsync tool (part of the standard Subversion distribution), as described in Google Products> Hosting Project (Data Liberation Front) .




See also the http://whygitisbetterthanx.com/ site.

+38
Aug 02 '09 at 10:54
source share

One obvious advantage: you can grow when you are away from the server. For example, you might have a laptop with your local git repository and click on your server (or github). Now suppose you went somewhere without an internet connection ... in Subversion, you had to do without any commits until you reconnected. With DVCS, you can commit locally (and return, branch, etc.), and then return these commits when you get home.

+25
Aug 02 '09 at 9:01
source share

The really strong advantage of both git and mercury in setting up a "home project" is that the new repository is trivially set up. In git, you just do git init at the root of your code tree, and you have a new repository.

Then you can add, commit, fork, etc. right away. svn has a high setup cost since you need to create a separate repository location and URL before you can create a working copy and start normal VCS operations.

Document storage is not a problem in git or mercury, but, of course, with git (not sure about hg). I would advise against storing large media files (something from 100M up), since it does not work very well in some operations.

+13
Aug 02 '09 at 9:20
source share

I use git for personal projects to "collaborate with myself." I have storages in the linux window on my home network that are accessible through a tunnel from anywhere. Then I will clone it on my home desktop, my laptop, maybe at work, and I see it or work on it anywhere. I can make changes, get the latest and have backups in different places. The very nice lightness and speed with which git allows you to switch between branches. Found a bug? Switch to the "master", fix it, commit, click, and then go back to what you are doing. Lighter and faster than cvs or subversion.

In addition, I use git for small directories that are not even projects. The configuration directory for the apache server that hosts my website is git 'd, as well as the tomcat configuration directory for the same website.

I use it at work for everything, even though we are working on CVS transitioning to Subversion. I do not use git-cvs or git-svn, I just use git next to any product and keep my branches local. It is very convenient to be able to switch to another compiler of the last developer, check something, and then cancel.

Then, of course, there are two parts that can be a huge help for work or home projects.

In addition, if at work they still use punch cards, cvs or subversion, then using git at home is a great way to stay up to date and find out what effect it can have.

I don’t worry about technologies unless they bring something really new to the table. git. I'm a fan. You probably already understood that.

+5
Aug 02 '09 at 12:48
source share

Besides the details of many of the great features of hg, git, darcs, bzr and friends (without sarcasm, I'm a big fan), the highlights here:

  • With svn, you need to choose between saving your repository and keeping it in place. On-site means that if your drive is not working, your project is a toast. Offsite means that you cannot commit from an airplane or other disconnected situations, and when the network connection is bad, commits can be slow.

  • With any distributed VCS, it is trivial to create one or more “clones” of your “repo”. You can commit changes locally at any time, quickly, and then push these changes to the remote repo when a connection is available.

git, hg and others are loaded with functions (and bugs) that make them different from svn and cvs. But this is the main thing.

+5
Aug 02 '09 at 16:52
source share

Sharing projects is much easier with dvcs, because you do not need to give others access to your central repository computer. You can force him to create a copy and not allow him to make any commits anywhere if you want. If you want his changes, you can pull them from your computer to wherever you want, and not let him push them. This way you can check the changes first if you want. You are in complete control (if you want).

The main advantage is that you carry the entire repository on your laptop! It may take some time to evaluate what it really means when you are used to massive central repositories and all the associated problems. Of course, in many situations it is useful to have one, but again, you can control who has and what access to it. Thanks to a centralized vcs that prevents anyone from directly communicating with the central repository, this means a lot of extra work from some unfortunate turf. Commits must be made more or less manually, and with the help of dvcs the sod responsible for checking the code can transmit them in the same way as on its computer, as well as its own code.

There are ways to alleviate the above in vcs, but they still require additional maintenance (create components / views / something that is ever controlled by access, and only allow this). There really are no overhead in git / mercurial.

I would say that the more work is done outside of your company network, the more beneficial dvcs are. If you have quick access to the central repository and you can trust everyone to record their changes there, then the main forces of dvcs are not so important (although there are still some, but at the moment they are IMO balanced with a poor user interface).

+4
Aug 02 '09 at 9:49
source share

I don't know about mercurial, but my favorite git thing that is not possible in subversion is editing the story. For example, you can:

  • edit previous commits to make changes to the list of files that have been changed
  • reorder previous commits
  • delete completely from history
  • merge two or more commits. Separation
  • divided into parts
  • add subsequent changes to previous commits

In short, if you think you can do it, you probably can. This is very powerful once you become aware of this ability and are probably more important in many ways than just a distributed advantage.

+3
Aug 2 '09 at 9:01
source share

I want to emphasize that Mercurial and GIT are launched using the source control without the need for a server and make it easy to move your repository to another server if necessary.

Other benefits have been addressed in other answers.

+2
Jul 08 '11 at 13:13
source share

I used to have a subversion server for home synchronization. I have been running git for several years, but now I switched to hg. The reason is mostly simplicity. I must be able to master git, but still I do not.

Here's a great tutorial from Joel (one of the creators of StackOverflow) on hg.

+1
Jan 08 '13 at 15:27
source share



All Articles