From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@imag.fr>
Cc: "Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"git mailing list" <git@vger.kernel.org>
Subject: Re: How to split a patch
Date: Mon, 28 Jan 2008 02:27:23 -0800 [thread overview]
Message-ID: <7vy7aatfck.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <vpqfxwi5ljf.fsf@bauges.imag.fr> (Matthieu Moy's message of "Mon, 28 Jan 2008 10:47:32 +0100")
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
> "Paolo Ciarrocchi" <paolo.ciarrocchi@gmail.com> writes:
>
>> Yes it helps but I still wonder whether thereis a "simpler" way to achive that.
>> Is it possible to split a patch selecting the hunk in git gui or any
>> other graphical
>> tool?
>
> You can apply the patch without commiting it, and them make several
> partial commits, by right-click "stage hunk for commit" in git-gui.
Yes, and you can do the same with "git add -i". These tools are
not quite nice, as they encourage a wrong workflow of committing
what you haven't had as a whole in the work tree. By
definition, you are making untested commits between your base
commit (that presumably was tested well) and your final commit
(that would also be tested well).
Ideally, once you have a perfect state (i.e. the shape of the
tree recorded by the last commit in your "split" series), you
should be able to make a commit, and walk backwards, removing
the fanciest "finishing touches" changes from the work tree
files, test it, and record it as a new commit between where you
are and one commit before it. A possible workflow could be:
$ work work work, now it is perfect.
$ git commit -a -m 'Now it is perfect'
$ edit away the fanciest bits
$ test test, the basics still work.
$ git commit --splice -a -m 'Almost there'
And the last "git commit --splice" would record the tree object
as a commit, whose parent is the parent of the current HEAD, and
record the tree of the current HEAD as a (rewritten) commit that
is a child of that commit.
Graphically, you would start from (X is "the perfect commit"):
---o-------X
then "--splice" would create a new commit "W" and record the
same tree as X as a new commit X' that is a child of W:
.--W---X'
/
---o-------X
There is no such tool yet, though.
The splitting you can do with "rebase -i" instead walks
forwards. That also lets you test before you make commits in
each step.
next prev parent reply other threads:[~2008-01-28 10:28 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-28 9:05 How to split a patch Paolo Ciarrocchi
2008-01-28 9:25 ` Junio C Hamano
2008-01-28 9:32 ` Paolo Ciarrocchi
2008-01-28 9:47 ` Matthieu Moy
2008-01-28 10:27 ` Junio C Hamano [this message]
2008-01-28 10:40 ` Junio C Hamano
2008-01-28 10:49 ` Mike Hommey
2008-01-28 10:44 ` Wincent Colaiuta
2008-01-28 12:47 ` Johannes Schindelin
2008-01-28 10:27 ` Wincent Colaiuta
2008-01-28 10:37 ` Boaz Harrosh
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=7vy7aatfck.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Matthieu.Moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=paolo.ciarrocchi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).