RE: [PATCH] branch: make -v useful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kerry, Richard wrote:
> 
> > From: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> > Sent: 10 June 2021 04:26
> > 
> > Kerry, Richard wrote:
> > > > Do you always push to the same remote branch you pull from?
> > 
> > > [RK] Yes.  There are two people doing most of the work , me and one
> > other.  We each mostly:
> > > [RK]  1.  Are not working on the same things.  Ie we don't generate
> > > many conflicts [RK]  2.  Pull and push to the same branch.  Ie each of
> > > us has a branch that we work on.  He uses "master", I have my own (It
> > > is a single very long-lived branch - I know that isn't a recommended
> > > workflow but that's where we are for the moment)
> > 
> > I call this a two-way workflow.
>  
> Ok, I'm  not sure I've heard of that.

You probably haven't, because I invented it.

Just like in a two-way street cars can go on both directions, in a
two-way branch you push and pull from the same destination.

> > > [RK] Merges are infrequent, but because we are working in different areas,
> > we merge to "our own" branch (few conflicts, usually) and push to its
> > remote.
> > 
> > This is crucial. 
> 
> Is it ?
> 
> > Is the local and remote branch always the same?
> 
> Yes.
> 
> > In other words: do you always pull from "origin/topic", and push to "topic"?
> 
> Yes.

Then that's a two-way branch.

> > > [RK] I have never yet done a rebase, but need to do so soon as there is
> > work in an area that we have both worked on.  Then it will be pushed to the
> > usual place - ie the two branches mentioned above.
> > 
> > When you involve another branch is sounds like you will be in a triangular
> > workflow.
> > 
> > You would be fetching from remote branch B, merging to local branch A, and
> > pushing to a remote branch A.
> > 
> > > [RK] So basically, no, not triangular at all, if I understand the meaning of
> > triangular (pull and push to different remotes).
> > 
> > No, once again: triangular workflow doesn't necessarily involve a different
> > remote (although it usually does).
> > 
> > You can pull from branch B from a central repository, and push to branch A
> > from the same repository, and that would be triangular, not two-way.
> > 
> > 
> > It's understandable that users are confused about this--since in fact many
> > developers are confused too. It would be nice if git had some documentation
> > about the different workflows, alas it doesn't at the moment.
> > 
> > Basically in my view there are four workflows:
> > 
> >   1. Central - two-way: push and pull the same branches from the same
> >      repo.
> >   2. Distributed - two-way: push and pull the same branches, but from
> >      different repositories (master <-> origin/master,
> >      topic <-> github/topic)
> >   3. Central - triangular: push and pull different branches from the
> >      same repo.
> >   4. Distributed - triangular: push and pull different branches from
> >      different repositories.
> > 
> > It sounds to me you are mostly in #1, but soon dabbling into #3.
>  
> I think we are just doing #1.
> We moved a few years ago from Subversion to Git.  Before that we were on CVS (actually CVSNT).  Those are centralized, with merging and branches allowed, but not different repos.
> Originally all the work produced a single final product installer.  Since my work and his turned out to be on different release cycles it was changed so now there are two separate products.
> My part has some dependencies on his, so I need occasionally to incorporate his changes into my branch.
> I occasionally changes files that will go into his final product, so there is then the occasional merge from my branch to his.
> 
> Actually maybe there is some #3.
> After merging his to mine, then mine back to his, I will push both.  Does that make it #3?

Yes, you sometimes use a triangular workflow: pull from your branch,
push to his branch. Even though it's on the same repository.

Either way, you probably always configure the upstream branch to be your
branch, so you always know what your local "topic" points to on the
remote.

-- 
Felipe Contreras



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux