Darcs vs. git annoyances: pushing specific patches

With darcs, it’s easy to push a limited number of patches, instead of everything in the branch. There are several ways to do this:

The default is interactively:

$ darcs push 

Tue Jan  1 22:33:33 EST 2008  Mark Stosberg <mark@stosberg.com>
  * RT#1234: new subsystem
Shall I push this patch? (1/1)  [ynWsfvpxdaqjk], or ? for help:

Even if you’ve never used darcs, before it’s easy to figure what to do. You might press “?” for help:

How to use push:
y: push this patch
n: don't push it
w: wait and decide later, defaulting to no

s: don't push the rest of the changes to this file
f: push the rest of the changes to this file

v: view this patch in full
p: view this patch in full with pager
x: view a summary of this patch

d: push selected patches, skipping all the remaining patches
a: push all the remaining patches
q: cancel push

j: skip to next patch
k: back up to previous patch

?: show this help

I like to use “x” to review which files I’m about to push, or “p” to review the patch in a pager. I haven’t yet found that git has this kind of review possibility built into the workflow. Also with darcs, it’s easy to push just one patch:

$ darcs push -p 'new subsystem'

It’s also very useful to push all the patches related to a specific ticket or project:

$ darcs push -p 'RT#1234'

In darcs we call that spontaneous branches because you get some benefits of a branch, without actually doing anything to create one.

The related user experience with git push is worse in a couple significant ways. First, I don’t see a way to use the human readable patch name. A separate step is required to review ‘git log’ to find the SHA1 hash, which must be copy/pasted, because there’s no way you remember it like a human-friendly word or phrase like darcs allows.

Armed with that, you ready to start the four step process that git requires to push specific patches, by creating a new branch, ‘cherry-picking’ to it, doing the push, and then deleting the new branch

$ git checkout --track -b <tmp local branch> origin/<remote branch>
$ git cherry-pick -x <sha1 refspec of commit from other (local or remote) branch>
$ git push origin <tmp local branch>
$ git branch -D <tmp local branch>

It’s because of a number of annoyances like this that I continue to use darcs whenever I can, and git when I have to.

Recent Entries

Close