# [RFC] pull --set-upstream implementation

1 messages from 2019-02-27 to 2019-02-27. Participants: BOMPARD CORENTIN p1603631.
Thread: https://gitlist.dev/t/50606

## BOMPARD CORENTIN p1603631, 2019-02-27 14:05

Subject: [RFC] pull --set-upstream implementation
Message-ID: <1551276325342.31383@etu.univ-lyon1.fr>
URL: https://gitlist.dev/e/1551276325342.31383%40etu.univ-lyon1.fr

```
We are currently working on adding "--set-upstream <remote> <branch>" to pull, that will work like "push --set-upstream <remote> <branch>"
The main usage should be "git pull --set-upstream <remote> <branch>"
However:

* <branch> could be a refspec like "refs/heads/*"

* If there is an error such as invalid URL or unreachable host we don't want to edit the config

It makes more sense to us to implement the "--set-upstream" logic in git fetch which would let us test the remote and manage when called with a refspec. As a side effect: it will add the "--set-upstream" argument to fetch. 
Essentialy we see 3 options:

1- add the "--set-upstream" argument directly in builtin/pull.c it will make it harder to parse the refspec and test the remote

2- add the "--set-upstream" as a visible argument of fetch as fetch --set-upstream could be useful

3- add the "--set-upstream" as a hidden argument of fetch

Option 2 seems the best choice to us, any suggestion? 

Thanks in advance.
Corentin BOMPARD, Nathan BERBEZIER, Pablo CHABANNE.
    

```
