From: Thien-Thi Nguyen <ttn@gnuvola•org>
To: git@vger•kernel.org
Subject: git-cherries
Date: Mon, 27 Feb 2012 11:56:19 +0100 [thread overview]
Message-ID: <874nucee98.fsf@gnuvola.org> (raw)
[-- 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
next reply other threads:[~2012-02-27 11:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 10:56 Thien-Thi Nguyen [this message]
2012-02-27 19:27 ` git-cherries Jeff King
2012-03-02 11:19 ` git-cherries Thien-Thi Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874nucee98.fsf@gnuvola.org \
--to=ttn@gnuvola$(echo .)org \
--cc=git@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox