pull, fetch: add --set-upstream option
authorCorentin BOMPARD <corentin.bompard@etu.univ-lyon1.fr>
Mon, 19 Aug 2019 09:11:20 +0000 (11:11 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Aug 2019 20:05:58 +0000 (13:05 -0700)
commit24bc1a129260eaf713c87f087f28883fe18891b5
tree3c5098f09f385529668f3a3b5915f69c1a093346
parentff66981f4593aec0f3b3eeace0eacb7dbe44fd8c
pull, fetch: add --set-upstream option

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 is mostly equivalent to cloning project-main-repo (which sets
upsteam) and then "git remote add" my-public-fork, but may feel more
natural for people using a hosting system which allows forking from
the web UI.

This functionality is analog to "git push --set-upstream".

Signed-off-by: Corentin BOMPARD <corentin.bompard@etu.univ-lyon1.fr>
Signed-off-by: Nathan BERBEZIER <nathan.berbezier@etu.univ-lyon1.fr>
Signed-off-by: Pablo CHABANNE <pablo.chabanne@etu.univ-lyon1.fr>
Signed-off-by: Matthieu Moy <git@matthieu-moy.fr>
Patch-edited-by: Matthieu Moy <git@matthieu-moy.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/fetch-options.txt
builtin/fetch.c
builtin/pull.c
t/t5553-set-upstream.sh [new file with mode: 0755]