DEV Community

Jahanzeb Nawaz
Jahanzeb Nawaz

Posted on

Git branch upstreaming

hey folks, if you tried to do a git pull and you came across such a response where the command did not worked and asked you to set the upstream branch then you are at right place.

git pull error message

You asked me to pull without telling me which branch you
want to merge with, and 'branch.uat.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:

    [branch "test22"]
    remote = <nickname>
    merge = <remote-ref>

    [remote "<nickname>"]
    url = <url>
    fetch = <refspec>

See git-config(1) for details.
Enter fullscreen mode Exit fullscreen mode

here are the following steps to fix it:

git branch --set-upstream test02 origin/test02 
Enter fullscreen mode Exit fullscreen mode

and after that try this command again

git pull
Enter fullscreen mode Exit fullscreen mode

🎉 here you go with a working upstream branch

Top comments (0)