git/list[1] front-page[2] threads[3] people[4] search[5] about
 

RE: [PATCH] branch: make -v useful

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 10, 2021, 03:26 UTC
Message-ID
<60c18651e2e78_af4cf2086a@natae.notmuch>
In-Reply-To
<AS8PR02MB7302955796AAEF8B9063505E9C379@AS8PR02MB7302.eurprd02.prod.outlook.com>
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.

If I understand correctly each of you have your own branch, but you both pull and push to your corresponding branch (he to his branch, you to your branch).

> > How about rebasing or merging? Do you use the same remote branch?
> [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 the local and remote branch always the same?

In other words: do you always pull from "origin/topic", and push to "topic"?

Or do you sometimes pull from another 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.
Cheers.
-- 
Felipe Contreras
Previous: Kerry, RichardNext: Kerry, Richard
Message 12 of 18 in “branch: make -v useful”
  1. branch: make -v usefulFelipe Contreras, Jun 5, 2021
  2. Ævar Arnfjörð BjarmasonJun 5, 2021
  3. Jeff KingJun 5, 2021
  4. Felipe ContrerasJun 7, 2021
  5. Jeff KingJun 8, 2021
  6. Felipe ContrerasJun 8, 2021
  7. Jeff KingJun 8, 2021
  8. Felipe ContrerasJun 8, 2021
  9. Kerry, RichardJun 8, 2021
  10. Felipe ContrerasJun 8, 2021
  11. Kerry, RichardJun 8, 2021
  12. Felipe ContrerasJun 10, 2021
  13. Kerry, RichardJun 25, 2021
  14. Felipe ContrerasJun 25, 2021
  15. Felipe ContrerasJun 7, 2021
  16. Ævar Arnfjörð BjarmasonJun 7, 2021
  17. Felipe ContrerasJun 7, 2021
  18. Felipe ContrerasJun 7, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.