Subject: Commit cherry-picking

From: Alberto Bertogli <[email-masked]>
Date: Tue, 3 Apr 2007 00:42:37 -0300

Hi!

I often use darcs, and one feature I miss when I use git is the ability
to do cherry-picking on what I'm about to commit.

It allows me to do small changes to the code when I'm working on
something else, and don't do ugly commits.

I know the proper way to do this would be to have different branches and
all. But that means I have to switch between branches to do quick fixes,
which is an expensive operation in human terms, because I have to stop
thinking about the code and switch branches and so on.

So I wrote two small scripts to do that: git-pcp and git-commit-cp. The
former acts as a helper to the later. Both are attached.

git-pcp takes a diff file, and produces two files: one with the hunks to
apply, and another one with the ones to skip. It asks the user to
select, for each hunk, where to put it.

git-commit-cp is the command to use, which calls git-pcp to do the
cherrypicking, and then applies the corresponding patches.

The implementation of git-pcp should be better (the diff parsing is not
as strong as it should be, although it works for most cases; and the
user interaction sucks, because I don't like UI =), so it's working but
it needs some improvements.

I wanted to ask you if this was an acceptable command to add to git, and
if you had any recommendations or thoughts about the implementation.

Thanks a lot,
		Alberto

PS: Is there a way of telling git-diff how many context lines to use?