Dotan
Dotan

Reputation: 7622

Git: same remote upstream for two local branches

I have two local branches, master and dev When I write git branch -v I get

master    f83fskr [origin/master: ahead 2] some commit message
def       kfdsj42 other commit message

I want both branches to have origin/master as their upstream branch, so that it will show

master    f83fskr [origin/master: ahead 2] some commit message
def       kfdsj42 [origin/master: ahead 3] other commit message

And also so that I could use git pull, git push without specifying a branch.

How can I achieve this? (-u didn't work)

Upvotes: 3

Views: 391

Answers (1)

Sajib Khan
Sajib Khan

Reputation: 24166

Checkout to def branch and set-upstream-to (-u) origin/master branch. Now, git push, git pull commands should work.

$ git checkout def
$ git branch -u origin/master

Upvotes: 2

Related Questions