git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-cherries
@ 2012-02-27 10:56 Thien-Thi Nguyen
  2012-02-27 19:27 ` git-cherries Jeff King
  0 siblings, 1 reply; 3+ messages in thread
From: Thien-Thi Nguyen @ 2012-02-27 10:56 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

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!

_____________________________________________

[-- Attachment #2: git-cherries --]
[-- Type: application/octet-stream, Size: 454 bytes --]

#!/bin/sh
blurb="${1-cherry}"
git status --short \
    | sed '/^ M /!d;s///' \
    | while read filename
do
    printf '\nprocessing: %s\n' $filename
    n=0
    while [ "$(git status --short -- $filename)" ]
    do
        n=$(expr 1 + $n)
        printf 'y\nq\n' | git add --patch $filename >/dev/null
        printf '%5d -- ' $n
        git commit -m"$n $filename ($blurb)" \
            | sed '1d;s/.* changed, //;s/[^0-9,]//g;s/,/& /'
    done
done

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-02 11:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-27 10:56 git-cherries Thien-Thi Nguyen
2012-02-27 19:27 ` git-cherries Jeff King
2012-03-02 11:19   ` git-cherries Thien-Thi Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).