{"thread":{"id":"27075","subject":"rebase on remote branch","startedAt":"2011-04-12T17:17:06Z","lastAt":"2011-04-12T18:50:02Z","messageCount":3,"participants":["allstars","Dirk Süsserott","Antriksh Pany"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"165697","messageId":"6b4c9a4d-075c-4805-8fad-bacecb24e9de@w7g2000pre.googlegroups.com","threadId":"27075","inReplyTo":null,"subject":"rebase on remote branch","fromName":"allstars","fromEmail":"allstars.chh@gmail.com","sentAt":"2011-04-12T17:17:06Z","receivedAt":"2011-04-12T17:17:06Z","isPatch":false,"sender":{"key":"allstars.chh@gmail.com","avatar":null},"body":"hi\nfirst I know rebase on remote branch is bad idea\nso I am here asking for suggestions if you can kindly provide some\n\nin my server I got two branches , master and release ,\nand release is branched from master\n\n0---0---0---0-- master\n        \\\n           0---0-- release\n\nour work mainly focus on master, so we will keep committing code to\nmaster\nfor some reasons, release branch is for others, and it has some\ncommits that master doesn't have\n\nand now in every week, we have some stable code in master branch\nso we also want the release branch also has these new code\n\n0---0---0---0---*---*---* master\n        \\\n           0---0-- release\n\nhow should we do now??\n\ncurrently our way is doing rebase in our local pc\n\n0---0---0---0---*---*---* master\n                                    \\\n                                      0'---0'-- release\nin release branch\n$>git rebase master\n\nbut in that way when we want to push the release branch back\nit will fail because it's non-fast-forward updates\nso we doing git push -f origin release to force it to 'rebase' on our\nremote server\n\n\nor if we use cherry-pick model\n\n0---0---0---0---*---*---* master\n        \\\n           0---0---*---*---* release\n\nbut in this case , how do we do it in script?\nI mean, how do we know we need to start cherry-pick from the 1st '*'\nto the 3rd '*' in master\n\nmore precisely , if A to E represents the commit SHA1\n\n0---0---0---0---A---B---C---D---E master\n        \\\n           0---0---A'---B'---C' release\n\nthe 3 cherry-picks A' B' C' on release branch won't have the same SHA1\nfor A B C in master\nhow can we know effectively we need to start cherry-pick from C to E\non master\n\n\nthanks\n"},{"id":"165700","messageId":"4DA49504.3030208@dirk.my1.cc","threadId":"27075","inReplyTo":"6b4c9a4d-075c-4805-8fad-bacecb24e9de@w7g2000pre.googlegroups.com","subject":"Re: rebase on remote branch","fromName":"Dirk Süsserott","fromEmail":"newsletter@dirk.my1.cc","sentAt":"2011-04-12T18:08:04Z","receivedAt":"2011-04-12T18:08:04Z","isPatch":false,"sender":{"key":"newsletter@dirk.my1.cc","avatar":null},"body":"Am 12.04.2011 19:17 schrieb allstars:\n> hi\n> first I know rebase on remote branch is bad idea\n> so I am here asking for suggestions if you can kindly provide some\n>\n> in my server I got two branches , master and release ,\n> and release is branched from master\n>\n> 0---0---0---0-- master\n>          \\\n>             0---0-- release\n>\n> our work mainly focus on master, so we will keep committing code to\n> master\n> for some reasons, release branch is for others, and it has some\n> commits that master doesn't have\n>\n> and now in every week, we have some stable code in master branch\n> so we also want the release branch also has these new code\n>\n> 0---0---0---0---*---*---* master\n>          \\\n>             0---0-- release\n>\n> how should we do now??\n>\n> currently our way is doing rebase in our local pc\n>\n> 0---0---0---0---*---*---* master\n>                                      \\\n>                                        0'---0'-- release\n> in release branch\n> $>git rebase master\n>\n> but in that way when we want to push the release branch back\n> it will fail because it's non-fast-forward updates\n> so we doing git push -f origin release to force it to 'rebase' on our\n> remote server\n>\n>\n> or if we use cherry-pick model\n>\n> 0---0---0---0---*---*---* master\n>          \\\n>             0---0---*---*---* release\n>\n> but in this case , how do we do it in script?\n> I mean, how do we know we need to start cherry-pick from the 1st '*'\n> to the 3rd '*' in master\n>\n> more precisely , if A to E represents the commit SHA1\n>\n> 0---0---0---0---A---B---C---D---E master\n>          \\\n>             0---0---A'---B'---C' release\n>\n> the 3 cherry-picks A' B' C' on release branch won't have the same SHA1\n> for A B C in master\n> how can we know effectively we need to start cherry-pick from C to E\n> on master\n>\n>\n> thanks\n>\n\nHi,\n\nif you have:\n\n0---0---0---X---A---B---C---D---E master\n          \\\n             0---0 release\n\nthen you could do\n\n$ git rebase --onto release X master\n\nto get this:\n\n0---0---0---X---A---B---C---D---E master\n          \\\n             0---0---A'---B'---C'---D'---E' release\n\nIOW, it rebases everything between X (w/o X itself) and master (which is \nE, including E) onto release.\n\nOr, with\n\n$ git rebase --onto release X C\n\nyou would get:\n\n0---0---0---X---A---B---C---D---E master\n          \\\n             0---0---A'---B'---C' release\n\nHTH.\n\n     Dirk\n"},{"id":"165704","messageId":"BANLkTimGQ60TU5WGEWG8b1OdNKOpnb=eCQ@mail.gmail.com","threadId":"27075","inReplyTo":"6b4c9a4d-075c-4805-8fad-bacecb24e9de@w7g2000pre.googlegroups.com","subject":"Re: rebase on remote branch","fromName":"Antriksh Pany","fromEmail":"antriksh.pany@gmail.com","sentAt":"2011-04-12T18:50:02Z","receivedAt":"2011-04-12T18:50:02Z","isPatch":false,"sender":{"key":"antriksh.pany@gmail.com","avatar":null},"body":">\n> or if we use cherry-pick model\n>\n> 0---0---0---0---*---*---* master\n>        \\\n>           0---0---*---*---* release\n>\n> but in this case , how do we do it in script?\n> I mean, how do we know we need to start cherry-pick from the 1st '*'\n> to the 3rd '*' in master\n>\n> more precisely , if A to E represents the commit SHA1\n>\n> 0---0---0---0---A---B---C---D---E master\n>        \\\n>           0---0---A'---B'---C' release\n>\n> the 3 cherry-picks A' B' C' on release branch won't have the same SHA1\n> for A B C in master\n> how can we know effectively we need to start cherry-pick from C to E\n> on master\n>\n\nYou can start by using\n  git log --cherry-pick ....\nwhich compares commits based on their patch contents, not just the SHA1.\n\nYou can use a moving tag (say APPLIED) to keep track of till what point\non master you have done the necessary cherry-picks, and then something like\nthis may work for you:\n  git log --cherry-pick release..master ^APPLIED\n\nThanks\nAntriksh\n"}]}