Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: "Steve Frécinaux" <nudrema@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [RFC] Re: git-svn: make git-svn commit-diff able to work without explicit arguments
Date: Tue, 02 Jan 2007 14:01:11 -0800	[thread overview]
Message-ID: <7vwt45rsuw.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20070102211339.GF17898@hades.madism.org> (Pierre Habouzit's message of "Tue, 2 Jan 2007 22:13:39 +0100")

Pierre Habouzit <madcoder@debian.org> writes:

> ... and
> sometimes think that in a A--B--C--D and in fact, I'd prefer to have:
>
>   {A,C}--B--D. how is it possible to do that in a not too cumbersome
> way? because that would make sens to work in some scratch branch, and
> then reorganize patches in a saner better way in the master branch.
>
>   But I fail to see how to achieve that without using cumbersome
> export-to-patch then git apply patch and edit logs which is painful and
> not really using git.

First of all, "format-patch and then edit" is a perfectly sane
way to use git.  Any workflow that takes advantage of cheap
branch creatin and cheap resetting of the tip of a branch _is_
"really using git".  It depends on the size of the series you
are redoing, but I do that all the time.

Also cherry-pick, rebase, squash merge are your friends.

If you are on $original branch (which may be your 'master') with
commits A--B--C--D:

	git checkout -b temp HEAD~3 ;# that's A
        git cherry-pick $original~1 ;# that's C
	git checkout $original
        git rebase temp

would make the $original A--C'-B'-D'.  Then:

	git checkout temp ; git reset --hard $original~4 ;# parent of A
	git merge -s squash $original~2 ;# squash A and C'

would prepare you to make a squashed commit out of the two to
the temp branch.  Then:

	git checkout $original
        git rebase --onto temp HEAD~2 ;# that's C'
	git branch -d temp

would give you (A+C)--B'-D' on $original branch.

StGIT would make life even easier for you.  It is designed to
make things like the above simpler.

  parent reply	other threads:[~2007-01-02 22:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-02 18:23 [RFC] git-svn: make git-svn commit-diff able to work without explicit arguments Steve Frécinaux
2007-01-02 18:40 ` [RFC] " Pierre Habouzit
2007-01-02 19:18 ` [RFC] " Eric Wong
2007-01-02 20:30 ` Junio C Hamano
2007-01-02 21:13   ` [RFC] " Pierre Habouzit
2007-01-02 21:26     ` Brian Gernhardt
2007-01-02 21:58       ` Jakub Narebski
2007-01-02 22:27         ` Pierre Habouzit
2007-01-02 22:01     ` Junio C Hamano [this message]
2007-01-02 23:09     ` Steve Frécinaux

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=7vwt45rsuw.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=nudrema@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