0

I have created a local branch

(master)$git checkout -b om-dev
(om-dev)$git branch -u origin/dev 

Show the tracking connection of local 'om-dev' to remote 'dev' from origin[1] Fig1: Show the tracking connection of local 'om-dev' to remote 'dev' from origin

(om-dev)$git branch -vv

Confirm that my local branch is tracking remote correctly

Fig2: Confirm that my local branch is tracking remote correctly

I have some local commits on 'om-dev' that I want to push to 'dev'

(om-dev)$git status

Show local branch is ahead of remote

Fig3: Show local branch is ahead of remote

Now, issue comes here:

(om-dev)$git push

Here, I expect to push my commit from om-dev branch to remote 'dev' branch without using full syntax ($git push origin dev or, $git push -u origin dev) But, I am seeing following complaint:

Complain pushing local branch

Fig4: Complain pushing local branch, even after successful upstream set already

Question: Why do I again need to track my branch using -u in my push statement? Shouldn't logically after already setting upstream, it should be able to resolve the remote branch and source when I only use 'git push' command.

Note: I have already tried using -u option, and it works as expected. But I am expecting why it doesn't work this way? The git version being used is: 2.19.1.windows.1

OmGanesh
  • 952
  • 1
  • 12
  • 24
  • 1
    Did you change your `push.default` setting, or is it defaulting to `simple`? (It's pretty clear that it is set to `simple`.) – torek Oct 20 '19 at 05:59
  • 1
    Use this before you push "git config push.default upstream" – Yasham Oct 20 '19 at 06:04
  • Thanks @torek the issue was the hidden push.default, which defaults was simple (by default). Setting it to upstream resolves, as suggested – OmGanesh Oct 20 '19 at 07:00

0 Answers0