git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-cherries

From
Jeff King <peff@peff.net>
Date
Feb 27, 2012, 19:27 UTC
Message-ID
<20120227192746.GC1600@sigill.intra.peff.net>
In-Reply-To
<874nucee98.fsf@gnuvola.org>
On Mon, Feb 27, 2012 at 11:56:19AM +0100, Thien-Thi Nguyen wrote:
Show 6 quoted lines
> 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
Previous: Thien-Thi NguyenNext: Thien-Thi Nguyen
Message 2 of 3 in “git-cherries”
  1. Thien-Thi NguyenFeb 27, 2012
  2. Jeff KingFeb 27, 2012
  3. Thien-Thi NguyenMar 2, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.