home

Boost Blog

Posts Tagged ‘git’

July 5th, 2010

Working with Git

Posted by jeremy on July 5th, 2010

During a brief slow period on a Friday afternoon I started pondering how much work I actually do, and if it was even useful knowing. Obviously all our code is stored in a version control system (git), so in a way all of the data for finding out the quantity of work is readily available. A little investigation and I found that it’s quite easy to pull a list of commits from git showing total lines added and deleted per file:

git log --oneline --numstat

I’ve committed a lot of code that I didn’t write, such as plugins, the Rails framework etc. So a quick and dirty ruby script later I could get a list of all unique files in all repositories that I’ve committed to. It was pretty easy to go through the list and create an exclusion list. I then broke out Ruport to aggregate everything by extension. That gave me the following table:

I’ve cleaned this up a little and collapsed some alternative extensions down.

Commits per week

Just over 110,000 lines added and 50,000 deleted, of which about 100,000 are to Ruby files. Now I’m not claiming to have written all those lines myself, any part of any line changed counts towards the total. All this does is illustrate the general balance of work that I do. There have been two lines added for every line deleted. This year has seen a lot of refactoring work, so it’ll be interesting to run the same exercise next year and see if the results are similar (of course git holds historical data, but we only started using it about 18 months ago, and previously had everything stored in subversion).

It’s interesting to see that the proportion of additons to deletions is much higher in view (rhtml/haml) files than in ruby code. This could point to the way things look being changed much more than the way things work.

Now if only there was a way to measure the quality of work. (Actually there are tools; metric_fu is a good starting point and we use it a lot at Boost. However, that’s going a little too far for this post).

Another interesting bit of data I extracted from git is the number of commits I’ve done per week over the last 52 weeks.

I’ve posted my script as a github gist. You  can run it by modifying the @repositories array with a list of git repositories, @author with your email address and @excludes with a list of regular expressions for excluding files. Run the script as ruby gitcount.rb. If it is run with the argument “files” then it will list individual files, making it easier to build the exclude list.

Tags: git, ruby
Posted in: Development, Random thoughts
No Comments
 
  • Categories

    • Agile (3)
    • assessment (2)
    • consumer trends (8)
    • Cool tools (5)
    • Curriculum (2)
    • cybersafety (1)
    • Design (6)
    • Development (14)
    • devices (2)
    • Drupal (1)
    • e-Learning (7)
    • e-learning research network (1)
    • informal learning (5)
    • inquiry (4)
    • key competencies (6)
    • learning communities (3)
    • magic and delight (5)
    • Maori achievement (2)
    • multiliteracies (1)
    • professional learning (6)
    • Publishing (3)
    • Random thoughts (3)
    • research (7)
    • Ruby on Rails (8)
    • Sarah's top ten (11)
    • Social media (7)
    • Social software: practices (5)
    • social software: tools (9)
    • software (4)
    • Software for Learning website (4)
    • student work (7)
    • teacher-learner roles (5)
    • teaching practice (9)
    • the curriculum (6)
    • transformation (10)
    • Usabilty (3)
    • Writing (1)
  • Archives

    • August 2010 (4)
    • July 2010 (6)
    • June 2010 (2)
    • April 2010 (1)
    • March 2010 (1)
    • February 2010 (1)
    • January 2010 (3)
    • December 2009 (1)
    • November 2009 (1)
    • October 2009 (4)
    • September 2009 (2)
    • August 2009 (3)
    • July 2009 (6)
    • June 2009 (3)
    • May 2009 (1)
    • April 2009 (6)
    • March 2009 (6)
    • February 2009 (11)
    • December 2008 (4)
    • November 2008 (6)
    • October 2008 (12)
    • September 2008 (7)
    • August 2008 (7)
    • July 2008 (4)
  • Boost Loves Design

    • I love Typography
    • IntuitionHQ | easy website usability
    • OMG It even has a watermark
    • Follow me on Twitter
    © Boost Limited.
    All rights reserved.
    CONTACT US
    info@boost.co.nz
    tel. (04) 939 0062
    fax. (04) 939 0063

    Level 6, 175 Victoria Street
    PO Box 11504, Wellington
    New Zealand