git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* rebase on remote branch
@ 2011-04-12 17:17 allstars
  2011-04-12 18:08 ` Dirk Süsserott
  2011-04-12 18:50 ` Antriksh Pany
  0 siblings, 2 replies; 3+ messages in thread
From: allstars @ 2011-04-12 17:17 UTC (permalink / raw)
  To: git

hi
first I know rebase on remote branch is bad idea
so I am here asking for suggestions if you can kindly provide some

in my server I got two branches , master and release ,
and release is branched from master

0---0---0---0-- master
        \
           0---0-- release

our work mainly focus on master, so we will keep committing code to
master
for some reasons, release branch is for others, and it has some
commits that master doesn't have

and now in every week, we have some stable code in master branch
so we also want the release branch also has these new code

0---0---0---0---*---*---* master
        \
           0---0-- release

how should we do now??

currently our way is doing rebase in our local pc

0---0---0---0---*---*---* master
                                    \
                                      0'---0'-- release
in release branch
$>git rebase master

but in that way when we want to push the release branch back
it will fail because it's non-fast-forward updates
so we doing git push -f origin release to force it to 'rebase' on our
remote server


or if we use cherry-pick model

0---0---0---0---*---*---* master
        \
           0---0---*---*---* release

but in this case , how do we do it in script?
I mean, how do we know we need to start cherry-pick from the 1st '*'
to the 3rd '*' in master

more precisely , if A to E represents the commit SHA1

0---0---0---0---A---B---C---D---E master
        \
           0---0---A'---B'---C' release

the 3 cherry-picks A' B' C' on release branch won't have the same SHA1
for A B C in master
how can we know effectively we need to start cherry-pick from C to E
on master


thanks

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

* Re: rebase on remote branch
  2011-04-12 17:17 rebase on remote branch allstars
@ 2011-04-12 18:08 ` Dirk Süsserott
  2011-04-12 18:50 ` Antriksh Pany
  1 sibling, 0 replies; 3+ messages in thread
From: Dirk Süsserott @ 2011-04-12 18:08 UTC (permalink / raw)
  To: allstars; +Cc: git

Am 12.04.2011 19:17 schrieb allstars:
> hi
> first I know rebase on remote branch is bad idea
> so I am here asking for suggestions if you can kindly provide some
>
> in my server I got two branches , master and release ,
> and release is branched from master
>
> 0---0---0---0-- master
>          \
>             0---0-- release
>
> our work mainly focus on master, so we will keep committing code to
> master
> for some reasons, release branch is for others, and it has some
> commits that master doesn't have
>
> and now in every week, we have some stable code in master branch
> so we also want the release branch also has these new code
>
> 0---0---0---0---*---*---* master
>          \
>             0---0-- release
>
> how should we do now??
>
> currently our way is doing rebase in our local pc
>
> 0---0---0---0---*---*---* master
>                                      \
>                                        0'---0'-- release
> in release branch
> $>git rebase master
>
> but in that way when we want to push the release branch back
> it will fail because it's non-fast-forward updates
> so we doing git push -f origin release to force it to 'rebase' on our
> remote server
>
>
> or if we use cherry-pick model
>
> 0---0---0---0---*---*---* master
>          \
>             0---0---*---*---* release
>
> but in this case , how do we do it in script?
> I mean, how do we know we need to start cherry-pick from the 1st '*'
> to the 3rd '*' in master
>
> more precisely , if A to E represents the commit SHA1
>
> 0---0---0---0---A---B---C---D---E master
>          \
>             0---0---A'---B'---C' release
>
> the 3 cherry-picks A' B' C' on release branch won't have the same SHA1
> for A B C in master
> how can we know effectively we need to start cherry-pick from C to E
> on master
>
>
> thanks
>

Hi,

if you have:

0---0---0---X---A---B---C---D---E master
          \
             0---0 release

then you could do

$ git rebase --onto release X master

to get this:

0---0---0---X---A---B---C---D---E master
          \
             0---0---A'---B'---C'---D'---E' release

IOW, it rebases everything between X (w/o X itself) and master (which is 
E, including E) onto release.

Or, with

$ git rebase --onto release X C

you would get:

0---0---0---X---A---B---C---D---E master
          \
             0---0---A'---B'---C' release

HTH.

     Dirk

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

* Re: rebase on remote branch
  2011-04-12 17:17 rebase on remote branch allstars
  2011-04-12 18:08 ` Dirk Süsserott
@ 2011-04-12 18:50 ` Antriksh Pany
  1 sibling, 0 replies; 3+ messages in thread
From: Antriksh Pany @ 2011-04-12 18:50 UTC (permalink / raw)
  To: allstars; +Cc: git

>
> or if we use cherry-pick model
>
> 0---0---0---0---*---*---* master
>        \
>           0---0---*---*---* release
>
> but in this case , how do we do it in script?
> I mean, how do we know we need to start cherry-pick from the 1st '*'
> to the 3rd '*' in master
>
> more precisely , if A to E represents the commit SHA1
>
> 0---0---0---0---A---B---C---D---E master
>        \
>           0---0---A'---B'---C' release
>
> the 3 cherry-picks A' B' C' on release branch won't have the same SHA1
> for A B C in master
> how can we know effectively we need to start cherry-pick from C to E
> on master
>

You can start by using
  git log --cherry-pick ....
which compares commits based on their patch contents, not just the SHA1.

You can use a moving tag (say APPLIED) to keep track of till what point
on master you have done the necessary cherry-picks, and then something like
this may work for you:
  git log --cherry-pick release..master ^APPLIED

Thanks
Antriksh

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

end of thread, other threads:[~2011-04-12 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-12 17:17 rebase on remote branch allstars
2011-04-12 18:08 ` Dirk Süsserott
2011-04-12 18:50 ` Antriksh Pany

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).