Version 17

    What are we doing?

    This document is about the desire to move Infinispan's source control from JBoss.org's Subversion hosting to GitHub.

     

    UPDATE: this has also been blogged about: http://infinispan.blogspot.com/2010/11/infinispan-likes-github.html

    When are we doing it?

    The plan is to maintain a copy of Infinispan's source tree on GitHub as of immediately, however the primary repository will still be the JBoss.org Subversion repository, until Infinispan 4.2.0.BETA1 is released.  After this release, the Subversion repository will be in read-only mode and the GitHub repository will become the primary repository.

    UPDATE: the migration has now completed.  Infinispan's Subversion repository is frozen in read-only mode, and all new work will happen on the source tree hosted on GitHub.

    The migration

    Please note that prior to the release of 4.2.0.BETA1, all work must be checked in to Subversion.  Even if this is on a different branch (e.g., Subversion trunk which is 5.0).  If anything is not checked it, it will not be migrated across to the new repository!

     

    There is some research work going on with Infinispan, and I understand this won't be anywhere near completion so as to be checked in.  In this case, I recommend the authors create a diff against their respective branch in Subversion, and when the new GitHub-hosted repository is live, check out your respective branch and apply the diffs there.

    Quick start

    A quick start to getting productive with Infinispan's new git repository.  This assumes you have downloaded and installed a recent version of git.

     

    1) Background reading

    Please read Emmanuel Bernard's excellent blog post on using git.  It's short, and very, very useful.  Also, it is worthwhile bookmarking this handy guide to git for Subversion users.

     

    2) Credentials

    Make sure your GitHub account is properly set up with your SSH key for commits, and you are added to the http://github.com/infinispan group.

     

    3) Clone the repository

    Clone the Infinispan repo on GitHub (this is the equivalent of checkout in Subversion)

     

    $ git clone git@github.com:infinispan/infinispan.git

     

    4) Branches

    Add remote refs to the branches you will work on (step 2 just gets you trunk - which is the master branch in git-speak)

     

    $ cd infinispan
    $ git checkout -b 4.2.x origin/4.2.x
    

     

    To list all of the remote branches available:

     

    $ git branch -r

     

     

    To check which branch is your current branch with

     

    $ git branch

     

    Switch branches with:

     

    $ git checkout <branch name>

     

    e.g.,

     

    $ git checkout master
    $ git checkout 4.2.x
    

     

    5) Committing

     

    Read http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html on how to write commit messages so they are compatible with git tools.  It is important that we stick with such a convention.

     

    Committing is simple:

     

    $ git commit -am "<commit message>"

     

    Note that this only commits the changes to your local clone of the repository.  To push your commits back to GitHub and share it with others, you would need to do:

     

    $ git push origin <branch to push>

     

    If before pushing, you have made a mistake in a commit, for example, there's a typo in the message, you can simply do:

     

    $ git commit --amend

     

    This will revert your last commit allowing you to add forgotten files, or commit once again with the correct message.

    6) Back and forward porting

    Back and forward porting is very easy with git.  Assume you've committed a fix on branch B1 and you want to commit the same fix to branch B2 as well.

     

    First, switch to the branch with the committed fix:

     

    $ git checkout B1

     

    Now, get the commit ID or your commit.  The log command lists all commits to the branch.  What you are looking for is a 41-character UUID (a bit like d8b346195b5c7a5c22963fb29ed94e5986534340)

     

    $ git log --pretty="oneline" 
    

     

    Once you know the commit ID, you switch to the branch you want to port the commit to.

     

    $ git checkout B2

     

    And you use the cherry-pick command to port the commit across.

     

    $ git cherry-pick <commit id>

     

    Done!

     

     

     

    Why git?

    http://whygitisbetterthanx.com/

     

    Specific to Infinispan,

    • Fast
    • Distributed/offline
    • Stashes
    • Real branches and tags (not just lame copies!)
    • Fast, reliable, effective merging

     

    Some git resources for newbies

    http://refcardz.dzone.com/refcardz/getting-started-git

    http://css.dzone.com/articles/subversion-git-morning

    http://git-scm.com/course/svn.html

    http://git-scm.com/documentation

    http://www.youtube.com/watch?v=4XpnKHJAok8

    http://java.dzone.com/articles/working-git

     

    Experiences by other JBoss.org projects

    http://in.relation.to/Bloggers/HibernateMovesToGitGitTipsAndTricks

    http://in.relation.to/Bloggers/GitIsAwesome

     

    Downloading git, git tools and integrations