Question

I just upgraded from 1.8.4.3 to 1.9.1, and I'm noticing a changed behavior.

In 1.8.4.3 when I would git checkout -b new_branch, and git push -u origin new_branch, 1.8.4.3 would create a new branch in the remote named origin.

In 1.9 it just says Branch git_1.9_test_branch set up to track remote branch master from origin by rebasing.

Why is this? How can I have 1.9 also create the branch on my remote named origin in a similar fashion to 1.8? If I don't do this, when I git push, my changes get pushed to the branch I branched off of (in this case master) which is obviously undesired.

An example below:

# 1.8.4.3
$ git checkout -b new_branch
Branch git_1.9_test_branch set up to track local branch master_newui by rebasing.
Switched to a new branch 'git_1.9_test_branch'

$ git push origin -u new_branch
Counting objects: 24, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.41 KiB | 0 bytes/s, done.
Total 6 (delta 3), reused 0 (delta 0)
To git@github.com:myorg/myrepo.com.git
 * [new branch]      new_branch -> new_branch
Branch new_branch set up to track remote branch new_branch from origin by rebasing.



# 1.9.1
$ git co -b new_branch
Branch new_branch set up to track local branch master_newui by rebasing.
Switched to a new branch 'new_branch'

$ git push -u origin new_branch
Branch new_branch set up to track remote branch master_newui from origin by rebasing.
Everything up-to-date

My global git config has

[push]
  default = upstream
Was it helpful?

Solution

The fix was to change my global .gitconfig file.

I had to update this:

[push]
  default = upstream

To this:

[push]
  default = simple
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top