Results tagged “git”

I just saw a patch I created on github attributed to “mark@freekbox.(none)”.   That’s nothing like an email I use and it’s annoying that git not only selected this as my identity to use in the commit log, but then didn’t even run it by me for a reality check. Now that I’ve committed that patch and pushed it to github, there’s no real way to alter that. Extra annoying.

By contrast, the first time you record a patch in a darcs repo, you are prompted for your e-mail address in a friendly way:

$ darcs record
Darcs needs to know what name (conventionally an email address)
to use as the patch author, e.g. 'Fred Bloggs <fred@bloggs.invalid>'.
If you provide one now it will be stored in the file 
'_darcs/prefs/author' and used as a default in the future.  
To change your preferred author address, simply delete or edit
this file.

What is your email address?

Easy and pleasant.

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.

Both darcs and git support a —dry-run option for pull, but git 1.6 provides no details about what it’s going to push. Take a look:

git push -v --dry-run git@github.com:markstos/foo.git
Pushing to git@github.com:markstos/foo.git
To git@github.com:markstos/foo.git
   b233f62..1eb8888  master -> master

Yes, git managed to repeat back to me the name of the remote repo not once, but twice, but didn’t tell me a single thing about the patches that might be pushed. Now compare that with “darcs push —dry-run”:

$ darcs push --dry-run --summary
Would push to "/home/mark/tmp/tmp2"...
Would push the following changes:
Thu Nov 13 22:24:40 EST 2008  m
  * My new patch name.

    M ./one.txt -2 +1

Making no changes:  this is a dry run.

darcs reports what’s going in plain English, including the patch names and file change details. Even better, if I just used darcs push, I would have gotten an interactive prompt by default, with a built-in help system:

$ darcs push
Pushing to "/home/mark/tmp/tmp2"...
Thu Nov 13 22:24:40 EST 2008  m
  * My new patch name.
Shall I push this patch? (1/1)  [ynWsfvpxdaqjk], or ? for help:

Using that, I can navigate between the patches, cherry pick which ones I want to push, and inspect each patch by reviewing just the file changes involved, or directly viewing the actual diffs.

The lack of an interactive “push” command for git is just one of the annoyances that cause me to continue to use darcs whenever I can, and git when I have to.

1

Recent Comments

Close