Git – Version Control for Grumpy Old Men?

Over the years I have used several version control tools. They have served me well and generally I have been happy with them all (I still use RCS, CVS and Subversion) so why do I find myself changing to Git?

Git is the version control system created by Linus Torvalds for tracking changes to the Linux kernel. More recently it has also been adopted by several other high-profile open source projects including Perl, Samba, U-Boot, VLC, WINE, X.org and many others. Git development is now overseen by Junio Hamano.

What sets Git apart from most other version control systems is that it is a distributed version control system. Rather than having a single repository containing the history of a project there are many repositories, in fact every working copy of a project contains the complete repository.


For example, if I check out a project from a CVS or Subversion repository then I get a snapshot of the source code from a particular point in time. This may be the current state or a past state at a time of my choosing. With Git I get a copy (clone) of the entire repository.


Lets say I want to see what changes have been made to a file or to the project as a whole over a period of time. With CVS I can use the cvs log command and this will connect back to the central repository to retrieve the information. With Git I have a local copy of the repository so no remote connection is needed and the process is much faster.

Now I start making some changes to the project source. Each time I want to remember a set of changes I have to commit them to the repository. Again I need a network connection and the changes will be stored in the central repository and visible to everyone (assuming I have commit privileges). Git lets me commit to my local repository without a network connection.

It is easy to forget in this seemingly always-connected world that actually not everyone is always connected and connections are not always all that fast even when they are available. The ability to work without a connection is a great benefit.

This lends itself particularly well to open source projects where developers are living and working all over the world. It is also ideal for people like me who do a lot of travelling and often find themselves in hotels with poor network connections.

Another benefit of changes being in my local repository is I can now check in frequently without worrying about breaking a build for others working on the project. I can record all my changes as I make them, backing out changes that don’t work, experimenting with new implementations, and so on. Only when I am fully satisfied that my changes are correct need I worry about pushing them back to the master repository and sharing them with other developers.

I can also hide all those minor increments and failed experiments. I can push back only the changes I want everyone to see.

So I am starting to use Git for the projects I work on. It is still early days yet so I have much to learn. If I discover anything really interesting then I shall share it with all of you.

http://git-scm.com/ – Git project home page.


Comments

7 comments

  1. “works great on Windows (git’s one big flaw)”
    That’s wrong:
    -> see msysgit
    We work cross-platform with git now in a Team
    of seven people on 30 different repositories without a hazzle.

  2. “I worked on a project that included two FPGA images that changed weekly. If we had used Git, old FPGA versions alone would have demanded maybe 1.5 GB of disk space from every developer towards the end of the project.”
    “you didn’t have to pull the 5 other undiffable revisions”
    What undiffable revisions?
    Git handles binary diffing fine. I was reading a post today from a guy who uses it to manage huge photos (~200mb per file), he says it takes 5.1gb vs 8.8gb (== the sum of all states of all images if stored without delta-ing)

  3. You may also try SCM Anywhere, which is a SQL-based SCM tool with fully integrated version control, bug tracking and build automation.
    http://www.scmsoftwareconfigurationmanagement.com

  4. I’ve used bazaar in several projects, and it’s just not that great.
    First of all, Bazaar is very slow, even the most recent versions. Branching takes a while, whereas in git it is instant.
    Second of all, bazaar’s merge/commit log management is poor. Git is so much better in this area – which is really important for sane, clean commit histories on big projects.
    Bazaar probably is “simpler”, so easier to start using right away. It also works great on Windows (git’s one big flaw). Otherwise, git is so much more powerful and faster, it’s dumb not to use it.
    My 2 cents.

  5. Keeping the whole repository local is not always the best solution. I worked on a project that included two FPGA images that changed weekly. If we had used Git, old FPGA versions alone would have demanded maybe 1.5 GB of disk space from every developer towards the end of the project. other large binaries such as .doc files and spreadsheets were also thrown in the repository as well. I’m still new to Git, but I miss how convenient the Subversion GUI was in this respect: If you wanted the latest spec, you didn’t have to pull the 5 other undiffable revisions you missed as well.

  6. Richard Danter - Wind River

    Yes indeed there are several open source and proprietary distributed VC tools.
    I can’t really comment on Bazaar since I have not used it, but Canonical certainly has done an excellent job with Ubuntu so I think it should be well worth taking a look.
    I ought to have mentioned one additional reason I am looking at git and that is to try and reduce the number of tools I am using. Not sure I will actually achieve that goal but I have to get used to git because of the work I do with Linux and other projects which use this tool.
    Thanks for suggesting Bazaar!

  7. Git is only one of many decentralised SCMs these day. Personally, I avoid git wherever possible because of its abysmal user-interface. GNU’s Bazaar is my favourite. If you’re used to CVS/Subversion you should feel at home. And it’s been developed and funded by Canonical, the guys behind Ubuntu. Definitely worth taking a look. http://bazaar-vcs.org/

Leave a Reply

Your email address will not be published. Required fields are marked *

*