# git-cherries

3 messages from 2012-02-27 to 2012-03-02. Participants: Thien-Thi Nguyen, Jeff King.
Thread: https://gitlist.dev/t/29754

## Thien-Thi Nguyen, 2012-02-27 10:56

Subject: git-cherries
Message-ID: <874nucee98.fsf@gnuvola.org>
URL: https://gitlist.dev/e/874nucee98.fsf%40gnuvola.org

```
For my personal use, i wrote git-cherries, attached.
It commits each hunk of every modified file separately
(creating cherries to cherry-pick later, you see).

I am writing to ask if this is already in Git somewhere,
and if not, for tips on how to make it faster / more elegant.

Please cc me in replies, as i am not subscribed.

Thanks!

_____________________________________________

```

## Jeff King, 2012-02-27 19:27

Subject: Re: git-cherries
Message-ID: <20120227192746.GC1600@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20120227192746.GC1600%40sigill.intra.peff.net
In-Reply-To: <874nucee98.fsf@gnuvola.org>

```
On Mon, Feb 27, 2012 at 11:56:19AM +0100, Thien-Thi Nguyen wrote:

> For my personal use, i wrote git-cherries, attached.
> It commits each hunk of every modified file separately
> (creating cherries to cherry-pick later, you see).
> 
> I am writing to ask if this is already in Git somewhere,
> and if not, for tips on how to make it faster / more elegant.

So if I understand correctly, this just creates a series of commits, one
per hunk, of what's in your working tree. And the commit messages won't
be useful, so this is really about recording the work somewhere so that
you can pick it out later using "git cherry-pick --no-commit", make a
real commit from some subset of the cherries, and then throw away the
cherries?

I think you could do this more simply by putting everything in a single
throw-away commit, then using "git checkout -p $throwaway" to pick the
individual cherries from the single commit. You don't grab the commit
message from $throwaway as you might with cherry-pick, but by definition
it's not a very good commit message anyway.

-Peff

```

## Thien-Thi Nguyen, 2012-03-02 11:19

Subject: Re: git-cherries
Message-ID: <87ehtb8d2p.fsf@gnuvola.org>
URL: https://gitlist.dev/e/87ehtb8d2p.fsf%40gnuvola.org
In-Reply-To: <20120227192746.GC1600@sigill.intra.peff.net>

```
() Jeff King <peff@peff.net>
() Mon, 27 Feb 2012 14:27:46 -0500

   So if I understand correctly, this just creates a series of commits, one
   per hunk, of what's in your working tree. And the commit messages won't
   be useful, so this is really about recording the work somewhere so that
   you can pick it out later using "git cherry-pick --no-commit", make a
   real commit from some subset of the cherries, and then throw away the
   cherries?

   I think you could do this more simply by putting everything in a single
   throw-away commit, then using "git checkout -p $throwaway" to pick the
   individual cherries from the single commit. You don't grab the commit
   message from $throwaway as you might with cherry-pick, but by definition
   it's not a very good commit message anyway.

Cool; "git checkout -p" was what i was missing.  Thanks for the tip!

```
