05Oct
2008

Tags: ,

In my previous post I introduced Git and discussed its distributed nature, speed, and powerful branching/merging capabilities. Today I'm going to continue the discussion on Git by writing about GitHub, Git in practice, and why Git may not be for everyone.

GitHub is Sexy

GitHub is an online Git repository hosting service that is freely available to anyone who wishes to share their Git managed projects. The service is very similar to SourceForge and Google Code Hosting, but because GitHub uses Git as its source control management system it offers a variety of advantages over other code hosting services.

To begin with, by using GitHub the barrier for working on and contributing to open source projects is significantly reduced. In traditional centralized models only certain developers are given commit rights to any given project repository. This creates a problem however for those developers who checkout the project and make changes. Those developers have no way of keeping track of their local changes and history unless they import the project into their own centralized repository. Doing this however means that the developer will lose the ability to easily synchronize their local project with the original project.

This problem goes away when using Git because all commits are local. You can checkout a project from GitHub, makes changes as you wish, and commit them to your local repository. This allows you to keep track of all of your changes and their history. If you want to synchronize with the original project's repository you simply need to issue a "pull" command to get the latest updates. As a bonus, if you come up with some feature that you think is particularly useful to the original project, you can ask the owner of that project to issue a "pull" request from your repository so your changes can be merged back into the master project.

Setting up your own remote Git repository is not that difficult, but GitHub adds a great web interface on top of Git that feels very much like a social networking site and serves as a platform for developers to share and contribute to each other's projects. A lot of big name open source projects (especially in the Ruby community) are hosted on GitHub including Rails, Merb, and Script.aculo.us so developers can feel confident that the guys at GitHub have their act together. GitHub also offers a variety of other features including private repositories (for a fee), a developer API, and integration with other services including Basecamp, Lighthouse, and Twitter.

Git in Practice

It's highly unlikely that a developer will be able to get their current project team to switch version control systems overnight, but with Git you don't have to. Git has powerful migration tools that can be used in conjunction with other version control systems, especially Subversion. Current Subversion users can use Git to manage the source code on their local machine while still staying in sync with their team's Subversion repository using a built in Git command called "git-svn". The git-svn command allows developers to "push" and "pull" commits to and from a centralized Subversion repository. This gives developers the power of local branching/merging capabilities using Git without forcing the technology on their team members. In fact, no one even needs to know that Git is being used.

Git, it's not for everyone

Git is a pretty incredible tool, but it is likely not going to be championed by all developers. To begin with, Git's learning curve can be a bit steep especially when compared with other version control tools. Developers who desire to give Git a shot should be very comfortable working with the command line because Git's visualization support leaves something to be desired.

Git was created by Linux kernel developer Linus Torvalds so it may not come as a huge surprise that Git support on Windows is a bit lackluster. I would guess that a majority of developers use Windows in some capacity so having a tool with weak Windows support is likely to hinder the adoption of that tool. Fortunately, there is a project called MSysgit which allows developers to use Git on their Windows machines. I've personally used this tool on my Windows XP laptop and find that it works pretty well.

Conclusion

Minor drawbacks aside, Git is a pretty amazing tool for source control management and will be the one that I use for my future projects. Its distributed nature, speed, and branching/merging capabilities make it a great tool for managing source code changes and revision history.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • DZone
  • FSDaily
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
  1. 2 Responses to “Getting it on with Git – Part 2”

  2. hi,
    that was very nice of you to post this stuff about git.. it was very useful.. i was actually searching this kind of an intro (after failing to understand the official online git manual) cos i am actually a beginner but i have one doubt..hope you will clear it…

    with git, a developer has his tree in his local machine …if some other developer wants to pull/push changes to/from the first developer, how will he do that.. do the developer’s local machine have a web address to specify the correct tree to merge… ?

    thanks

    By lakshmanan on Oct 7, 2008

  3. The users will need to set up remote repositories with one another. Remote repositories can be manually added to the Git configuration file found in /YOUR_PROJECT/.git/config or can be added automatically using the git remote add command.

    This is where Git becomes a bit complex especially for Windows users. To ensure security between developers Git uses public key cryptography and SSH to authenticate users. You might need to do a little research into these technologies to get a better understanding of how remote repositories work.

    The best way I found to practice pushing/pulling to/from a remote Git repository was to open a free GitHub account. They provide some great guides to help you get started at: http://github.com/guides/home.

    By Justin Spradlin on Oct 7, 2008

Post a Comment