ThiefMaster
ThiefMaster

Reputation: 318738

Automatically push to a remote branch with a different name?

I have a local branch named future-db which is tracking the remote branch wip/future-db. This part works fine:

$ git push -u upstream future-db:wip/future-db
Branch future-db set up to track remote branch wip/future-db from upstream.
Everything up-to-date

$ git status  
On branch future-db  
Your branch is up-to-date with 'upstream/wip/future-db'.

When doing git push I'd now expect it to push to wip/future-db. However, it creates a new remote branch named future-db.

Upvotes: 1

Views: 221

Answers (1)

ThiefMaster
ThiefMaster

Reputation: 318738

This happens because of the push.default config option being set to something different than upstream (usually the default. i.e. simple or matching).

Changing it using git config push.default upstream solves the problem and causes git push to push to the proper branch.

Upvotes: 3

Related Questions