{"thread":{"id":"5211","subject":"git rebase syntax question","startedAt":"2006-08-11T18:12:16Z","lastAt":"2006-08-11T22:07:17Z","messageCount":2,"participants":["Steve French","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"25137","messageId":"44DCC880.1080108@austin.rr.com","threadId":"5211","inReplyTo":null,"subject":"git rebase syntax question","fromName":"Steve French","fromEmail":"smfrench@austin.rr.com","sentAt":"2006-08-11T18:12:16Z","receivedAt":"2006-08-11T18:12:16Z","isPatch":false,"sender":{"key":"smfrench@austin.rr.com","avatar":null},"body":"I am missing something in the git rebase syntax ... am simply trying to \nremove some \"empty\" merge messages from my tree like:\n\ncommit 7538943ddf992b6ee5ec21d460f1eecc0afdb6f3\nMerge: 9f73763... bbab152...\nAuthor: Steve French <sfrench@us.ibm.com>\nDate:   Fri Aug 11 17:46:20 2006 +0000\n\n    Merge ../cifs-tmp/\n\nand reorder the commits so my commits that are not in the parent are the \nmost recent\n\nThe git repository is cloned from \n/pub/scm/linux/kernel/git/torvalds/linux-2.6.git and has one branch and \nhistory like\n         ...->A->MyCommits->B->MoreOfMyCommits->C->EmptyMergeMessages\nand I want to make my master look like\n         ...->A->B->C->MyCommits->MoreOfMyCommits\n   \n\nwhere \"MyCommits\" and \"MoreOfMyCommits\" are not in 2.6.18-rc4 yet, and  \nA, B, and C are the parent's (mainline kernel) commits (e.g. A is up to \nabout 2.6.18-rc1, B are those between rc1 and rc3, C would be rc4 and \nlater etc.)\n\nI tried doing the obvious\n    \"git rebase master\"\nbut that appears to be a no op\n    stevef@smf-t41p:~/cifs-2.6> git-rebase master\n    Current branch master is up to date.\n    stevef@smf-t41p:~/cifs-2.6> git-rebase origin\n    Current branch master is up to date.\n\n\n\nHow does one do this?\n"},{"id":"25143","messageId":"20060811220717.GC4788@sigio.intra.peff.net","threadId":"5211","inReplyTo":"44DCC880.1080108@austin.rr.com","subject":"Re: git rebase syntax question","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2006-08-11T22:07:17Z","receivedAt":"2006-08-11T22:07:17Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Aug 11, 2006 at 01:12:16PM -0500, Steve French wrote:\n\n> The git repository is cloned from \n> /pub/scm/linux/kernel/git/torvalds/linux-2.6.git and has one branch and \n> history like\n>         ...->A->MyCommits->B->MoreOfMyCommits->C->EmptyMergeMessages\n> and I want to make my master look like\n>         ...->A->B->C->MyCommits->MoreOfMyCommits\n\nSince A, B, and C are from upstream, they should still be linked\ndirectly together. So your history is probably more like this:\n    MyCommits--Merge--MoreOfMyCommits--EmptyMergeMessage\n   /          /                       /\n  A----------B-----------------------C\n\n> I tried doing the obvious\n>    \"git rebase master\"\n> but that appears to be a no op\n\nYou are already merged with master, so rebase doesn't think there is\nanything to do. You will have to rebase each of your merged segments\nonto a new rebase branch:\n  # Go back to just before the first merge...\n  $ git-branch commits1 Merge^\n  # And add all of C..commits1 on top of C\n  $ git-rebase C commits1\n  # Now we go back for the second merge...\n  $ git-branch commits2 EmptyMergeMessage^\n  # And add all of that on top of our previous work\n  $ git-rebase commits1 commits2\n  # At this point commits2 has A->B->C->MyCommits->MoreOfMyCommits.\n  # Now we can clean things up, making master the new desired branch.\n  $ git-checkout master\n  $ git-reset --hard commits2\n  $ git-branch -d commits1 commits2\n  $ git-prune\n\nI'm not sure if there's a simpler way to do it. Obviously if you do the\nrebase as you go along (instead of merging) it's much easier.\n\n-Peff\n"}]}