skip to main | skip to sidebar

Tables Latency Benchmark

Being the blog of Pete Hopkins. This pirate kills fascists.

Bling-Bling

www.flickr.com

Monday, December 15

topgit Means Never Having to Wait for Reviews

I’ve been using git for a little while now at work. Some rather clever Googlers have rigged up a tool that syncs a local repository with Perforce, so I can do local development and version control with git and then check the final CL in to the depot.

Over the weekend I started using topgit (README), a git wrapper that takes most of the work out of managing dependent “topic branches.” The gist is that you mark branches as depending on one another. Then, when you modify a branch, you can use the tg update command to propagate those changes to any branches that depend on it.

I’ve been doing a lot of large changes and refactorings recently, so what topgit really means for me is never having to wait for code reviews to keep working.

The basic workflow goes like this:

“refactor” is the name of my new branch, “blogger” is the trunk
$ tg create refactor blogger
hack hack hack
mv mv mv
add add add
commit commit commit


now mail out the CL for review
$ gitwrapper mail -m reviewer

In a pure Perforce environment, I couldn’t continue working on this code at all until the review came back and I could submit. With vanilla git, I can of course git checkout -b new-branch and keep going, and this is fine most of the time.

Where it starts to get sticky is when my reviewer has comments. No big deal, though. I can just git checkout back to the refactor branch, make those changes, and commit them.

Of course, I now need to update my new-branch so that I’m working from the latest intermediate state. git merge refactor handles that fairly well (sometimes I get pedantic and use git rebase) and I’m back to coding the new feature.

topgit supports exactly this pattern of development by automating the “update the new-branch” step. If I created the new-branch branch with tg create, then I could run tg update to merge in the latest versions of all of new-branch’s dependencies.

To continue, we have:

git checkout refactor
tweak tweak tweak
git commit -am "fixes from review"
git checkout new-branch
tg update
code code code

“All” is a very operative word in that last sentence. With topgit, a branch can have several dependencies, forming a DAG, and it will recursively update each one of them. This means that I can have several independent changes, with each out for review in parallel, but continue development on a new change that relies on all of them.

topgit works by keeping a separate reference branch for each topgit-managed branch. When you run tg update, it merges the dependencies into this branch, then merges that into the normal branch. This gives the added benefit that you can easily git rebase against the reference branch to clean up your commit graph.
Posted by Fin at 10:32 PM
Labels: programming

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Followers

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Blog Archive

  • ►  2009 (7)
    • ►  March (5)
    • ►  January (2)
  • ▼  2008 (36)
    • ▼  December (4)
      • Notes About Git + SVN + Google Code
      • Installing Graphziv on Mac OS X
      • Flaw: Constructor does Real Work
      • topgit Means Never Having to Wait for Reviews
    • ►  October (1)
    • ►  September (4)
    • ►  August (8)
    • ►  July (4)
    • ►  May (2)
    • ►  April (4)
    • ►  March (4)
    • ►  February (3)
    • ►  January (2)
  • ►  2007 (24)
    • ►  December (1)
    • ►  November (2)
    • ►  October (5)
    • ►  September (1)
    • ►  June (6)
    • ►  May (2)
    • ►  March (3)
    • ►  February (1)
    • ►  January (3)
  • ►  2006 (32)
    • ►  December (3)
    • ►  November (1)
    • ►  October (5)
    • ►  September (3)
    • ►  August (2)
    • ►  May (1)
    • ►  April (2)
    • ►  March (1)
    • ►  February (6)
    • ►  January (8)
  • ►  2005 (53)
    • ►  December (8)
    • ►  November (30)
    • ►  October (5)
    • ►  September (10)

Gamercard

Geekness

Twitter Updates

Twitter Updates

    follow me on Twitter

    About Me

    My Photo
    Fin
    I play board games and video games, and sing sea shanties when I can. I like shiny things and tech things and cat macros. I am aware of all Internet traditions.
    View my complete profile

    Search This Blog

    Friends’ Blogs

    • Mihai Parparita
      Infinite Mac: Snow and A/UX
      4 weeks ago
    • Jason Shellen
      methaphone
      10 months ago
    • Graham Waldon
      Card Game: The Fellowship of the Ring
      1 year ago
    • Michael Greenberg
      I’m looking for students!
      2 years ago
    • Adam Saks
      Mengatasi Ambeien Atau Wasir Kambuh
      6 years ago
    • Abstractioneer
      Things People Have Been Impeached For In the Past
      6 years ago
    • Kellan Elliott-McCrea
      New-ish site
      7 years ago
    • tins ::: Rick Klau's weblog
      Jaguar I-Pace first impressions
      7 years ago
    • Jason Goldman
      Links for 2017-02-22 [del.icio.us]
      9 years ago
    • Greg Stein
      PSA: Redbud Custom Homes
      9 years ago
    • --verbose
      How to Write Hello World in Go (in Go)
      12 years ago
    • Stacy Jenson
      I promise not to mommyblog
      12 years ago
    • Eric Case
      Creepy
      13 years ago
    • Vast Public Indifference
      Pompe Stevens, Enslaved Artisan
      13 years ago
    • watched pots | news
      Dogs are cool.
      14 years ago
    • Rachel Grey
      Six months with Ido Portal: game-changer 2011
      14 years ago
    • Lauren Davis
      Best Thing Today: Opinioncat Lady
      14 years ago
    • massless
      Dreams, discernment, and Google Reader
      14 years ago
    • saladwithsteve
      Building F# on Mac OS X
      16 years ago
    • Farang
      Kaiseki
      17 years ago
    • Marty Lichmann
      Janko Keyboard
      17 years ago
    • Shriram Krishnamurthi
      Project Beansprout Successful
      17 years ago
    • Mobile Vince
      Hawaii wrap-up
      19 years ago
    • Chinese Migrant Worker
      More Real Than Real
      19 years ago
    • Laurence Gonsalves
      Copyright Law and the King
      19 years ago
    • Josh Peterson
      St. Pardi Gras Shirts
      19 years ago
    • Buzz Andersen
    • Tina Huang
    • Evan Williams
    • Andy Yen
    • Biz Stone, Genius
    • Kimmy Richardson
    • tajc | taj campbell
    Show 10 Show All
    Powered By Blogger