Is this scatter-brained workflow realizable in Git?

Posted by Luke Maurer on Stack Overflow See other posts from Stack Overflow or by Luke Maurer
Published on 2010-05-12T01:51:44Z Indexed on 2010/05/12 1:54 UTC
Read the original article Hit count: 341

Filed under:
|

This is what I'd like my workflow to look like at a conceptual level:

  1. I hack on my new feature for a while
  2. I notice a typo in a comment
    • I change it
    • Since the typo is completely unrelated to anything else, I put that change in a pile of comment fixes
  3. I keep working on the code
  4. I realize I need to flesh out a few utility functions
    • I do so
    • I put that change in its own pile
  5. Steps 2, 3, and 4 each repeat throughout the day
  6. I finish the new feature and put the changes for that feature in a pile
  7. I push nice patches upstream: One with the new feature, a few for the other tweaks, and one with a bunch of comment fixes if enough have accumulated

Since I'm both lazy and a perfectionist, I want to be able to do some things out of order: I might correct a typo but forget to put it in the comment fix pile; when I prepare the upstream patches (I'm using git-svn, so I need to be pretty deliberate about these), I'll then pull out the comment fixes at that point. I might forget to separate things altogether until the very end. But I might /also/ have committed some of the piles along the way (sorry, the metaphor is breaking down …).

This is all rather like just using Eclipse changesets with SVN, only I can have different changes to the same file in different piles (having to disentangle changes into different commits is what motivated me to move to git-svn, in fact …), and with Git I can have my full discombobulated change history, experimental branches and all, but still make a nice, neat patch.

I've just recently started with Git after having wanted to for a good while, and I'm quite happy so far. The biggest way in which the above workflow doesn't really map into Git, though, is that a “bin” can't really be just a local branch, since the working tree only ever reflects the state of a single branch. Or maybe the Git index is a “pile,” and what I want is to have more than one somehow (effectively).

I can think of a few ways to approximate what I want (maybe creative use of stash? Intricate stash-checkout-merge dances?), but my grasp on Git isn't solid enough to be sure of how best to put all the pieces together. It's said that Git is more a toolkit than a VCS, so I guess the question comes down to: How do I build this thing with these tools?

© Stack Overflow or respective owner

Related posts about git

Related posts about Workflow