Re: [RFC] Re: git-svn: make git-svn commit-diff able to work without explicit arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pierre Habouzit <madcoder@xxxxxxxxxx> 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.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]