git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git rebase syntax question
@ 2006-08-11 18:12 Steve French
  2006-08-11 22:07 ` Jeff King
  0 siblings, 1 reply; 2+ messages in thread
From: Steve French @ 2006-08-11 18:12 UTC (permalink / raw)
  To: git

I am missing something in the git rebase syntax ... am simply trying to 
remove some "empty" merge messages from my tree like:

commit 7538943ddf992b6ee5ec21d460f1eecc0afdb6f3
Merge: 9f73763... bbab152...
Author: Steve French <sfrench@us.ibm.com>
Date:   Fri Aug 11 17:46:20 2006 +0000

    Merge ../cifs-tmp/

and reorder the commits so my commits that are not in the parent are the 
most recent

The git repository is cloned from 
/pub/scm/linux/kernel/git/torvalds/linux-2.6.git and has one branch and 
history like
         ...->A->MyCommits->B->MoreOfMyCommits->C->EmptyMergeMessages
and I want to make my master look like
         ...->A->B->C->MyCommits->MoreOfMyCommits
   

where "MyCommits" and "MoreOfMyCommits" are not in 2.6.18-rc4 yet, and  
A, B, and C are the parent's (mainline kernel) commits (e.g. A is up to 
about 2.6.18-rc1, B are those between rc1 and rc3, C would be rc4 and 
later etc.)

I tried doing the obvious
    "git rebase master"
but that appears to be a no op
    stevef@smf-t41p:~/cifs-2.6> git-rebase master
    Current branch master is up to date.
    stevef@smf-t41p:~/cifs-2.6> git-rebase origin
    Current branch master is up to date.



How does one do this?

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

* Re: git rebase syntax question
  2006-08-11 18:12 git rebase syntax question Steve French
@ 2006-08-11 22:07 ` Jeff King
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2006-08-11 22:07 UTC (permalink / raw)
  To: Steve French; +Cc: git

On Fri, Aug 11, 2006 at 01:12:16PM -0500, Steve French wrote:

> The git repository is cloned from 
> /pub/scm/linux/kernel/git/torvalds/linux-2.6.git and has one branch and 
> history like
>         ...->A->MyCommits->B->MoreOfMyCommits->C->EmptyMergeMessages
> and I want to make my master look like
>         ...->A->B->C->MyCommits->MoreOfMyCommits

Since A, B, and C are from upstream, they should still be linked
directly together. So your history is probably more like this:
    MyCommits--Merge--MoreOfMyCommits--EmptyMergeMessage
   /          /                       /
  A----------B-----------------------C

> I tried doing the obvious
>    "git rebase master"
> but that appears to be a no op

You are already merged with master, so rebase doesn't think there is
anything to do. You will have to rebase each of your merged segments
onto a new rebase branch:
  # Go back to just before the first merge...
  $ git-branch commits1 Merge^
  # And add all of C..commits1 on top of C
  $ git-rebase C commits1
  # Now we go back for the second merge...
  $ git-branch commits2 EmptyMergeMessage^
  # And add all of that on top of our previous work
  $ git-rebase commits1 commits2
  # At this point commits2 has A->B->C->MyCommits->MoreOfMyCommits.
  # Now we can clean things up, making master the new desired branch.
  $ git-checkout master
  $ git-reset --hard commits2
  $ git-branch -d commits1 commits2
  $ git-prune

I'm not sure if there's a simpler way to do it. Obviously if you do the
rebase as you go along (instead of merging) it's much easier.

-Peff

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

end of thread, other threads:[~2006-08-11 22:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-11 18:12 git rebase syntax question Steve French
2006-08-11 22:07 ` Jeff King

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).