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

Re: [PATCH] pull, fetch: add --set-upstream option

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 14, 2019, 17:38 UTC
Message-ID
<xmqqlfvv6417.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190814134629.21096-1-git@matthieu-moy.fr>
Matthieu Moy <git@matthieu-moy.fr> writes:
Show 19 quoted lines
> From: Corentin BOMPARD <corentin.bompard@etu.univ-lyon1.fr>
>
> Add the --set-upstream option to git pull/fetch
> which lets the user set the upstream configuration
> (branch.<current-branch-name>.merge and
> branch.<current-branch-name>.remote) for the current branch.
>
> A typical use-case is:
>
>     git clone http://example.com/my-public-fork
>     git remote add main http://example.com/project-main-repo
>     git pull --set-upstream main master
>
> or, instead of the last line:
>
>     git fetch --set-upstream main master
>     git merge # or git rebase
>
> This functionality is analog to push --set-upstream.

I was writing a one-paragraph summary for this topic, for the "What's cooking" report, and here is what I have:

 "git fetch" learned "--set-upstream" option to help those who first
 clone from a forked repository they intend to push to, add the true
 upstream via "git remote add" and then "git fetch" from it.

After describing it like so, I cannot shake the feeling that the workflow this intends to support feels somewhat backwards and suboptimal.

 - Unless you rely on server-side "fork" like GitHub does, you would
   first clone from the upstream, and then push to your "fork".  The
   flow whose first step is to clone from your "fork", not from the
   true upstream, feels backwards (cloning from upstream then adding
   your fork as a secondary may be more natural, without need for
   the complexity of --set-upstream to pull/fetch/push, no?).
 - The second step adds the true upstream using "git remote", and at
   that point, in your mind you are quite clear that you want to
   pull from there (and push to your own fork).  Not having the "I
   am adding this new remote; from now on, it is my upstream"
   feature at this step, and instead having to say that with your
   first "git pull", feels backwards.  If this feature were instead
   added to "git remote", then the last step in your example does
   not even have to say "main" (and no need for this new option),
   does it?
Previous: Matthieu MoyNext: Matthieu Moy
Message 16 of 19 in “Re: [PATCH] [WIP/RFC] add git pull and git fetch --set-upstream”
  1. Matthieu MoyApr 4, 2019
  2. Corentin BOMPARDApr 9, 2019
  3. [WIP/RFC] add git pull and git fetch --set-upstreamCorentin BOMPARD, Apr 17, 2019
  4. Junio C HamanoApr 18, 2019
  5. Corentin BOMPARDApr 19, 2019
  6. [WIP/RFC] add git pull and git fetch --set-upstreamCorentin BOMPARD, Apr 19, 2019
  7. Matthieu MoyApr 18, 2019
  8. Junio C HamanoApr 19, 2019
  9. Matthieu MoyApr 18, 2019
  10. Matthieu MoyApr 19, 2019
  11. Matthieu MoyApr 22, 2019
  12. pull, fetch: add --set-upstream optionMatthieu Moy, Aug 14, 2019
  13. Pratyush YadavAug 14, 2019
  14. Matthieu MoyAug 19, 2019
  15. pull, fetch: add --set-upstream optionMatthieu Moy, Aug 19, 2019
  16. Junio C HamanoAug 14, 2019
  17. Matthieu MoyAug 19, 2019
  18. Junio C HamanoAug 19, 2019
  19. Matthieu MoyAug 20, 2019

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.