"Push creates new remote heads" and my humble workflow (kind of dummy question)
Victor Sudakov
vas at sibptus.ru
Mon Jul 20 10:52:48 UTC 2020
Victor Sudakov wrote:
> > > >
> > > > If you have the rebase extension enabled, you can pass "--rebase" to "hg
> > > > pull", which will linearize the changesets after pulling.
> > >
> > > This sounds interesting. Can you please explain on the X,A,B example
> > > above, what "pull --rebase" will do?
> > >
> > > "rebase working directory to branch head" does not sound exactly clear.
> > > Which branch? I don't have branches, just accidentally create two heads
> > > from time to time.
> >
> > Has soon are you start having multiple heads, you have topological branches.
> >
> > In your case you have two heads B and C. each on they own "topological
> > branch"
> >
> >
> > A---B
> > \
> > \-C
> >
> > Lets says you committed "C" locally and pulled "B". (so you working copy is
> > on changeset of C).
> >
> > rebase will "recreate" C (as a new changeset, C') on top of B. So the result
> > will be:
> >
> > A---B---C'
>
> Great, but
>
> a) what will happen when I push this rearranged history back into the
> cloud repo?
>
> b) do I need to hint to rebase what it should rebase on what? How
> does it know that it should put C on top of B, and not vice versa? Does
> it just always put the working copy topological branch on top of the
> pulled branch?
>
> Anyway, I should try it out in order to understand.
I've found out that whenever "hg pull" informs me about "+1 heads" and
suggests runnning 'hg merge' to merge, I can just do
hg rebase && hg push
and my history again becomes linear. I think this is great. Thanks to all who
replied, especially about rebase.
--
Victor Sudakov, VAS4-RIPE, VAS47-RIPN
2:5005/49 at fidonet http://vas.tomsk.ru/
More information about the Mercurial
mailing list