How to setup default push branch?

han Halley May 21, 2013

I have two remote brance, everytime I wanna push, I need to switch another branch in the push window. Can I set a remote branch as default?

2 answers

6 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 21, 2013

Right-click your local branch in the sidebar on the left, then select Track Remote Branch, and then the remote branch you want it to track. That will then be the default when you push next time.

han Halley May 22, 2013

I did as what you said, the default pull branch changed, but default push branch didn't change.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2013

In that case you probably need to change your settings in Tools > Options > Git, the 'Push branches' option should be set to 'upstream'.

han Halley May 22, 2013

I did what you said, the result is the same as before.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 22, 2013

Hmm, that's a bug. 'Upstream' should pre-select that branch, I re-produced it here and will fix.

Todd Prouty August 30, 2013

Was this ever fixed? I think I'm experiencing the same issue.

Matthew Cross April 29, 2014

I'm still experiencing this issue as well...

Matthew Cross April 29, 2014

I just needed to allow SourceTree permission to change my GIT configuration (global tab) and the problem goes away

alexward78 June 23, 2015

I'm still seeing this issue. It has been over two years, when can we expect a fix?

Pip Jones October 29, 2015

Yes this is still an issue. In the right-click menu for the branch, the correct tracked remote is shown. If you click this menu item, the correct remote is pre-selected in the push branches dialogue. However, if you use the keyboard shortcut for push (command-shift-P in my case) when it opens the push branches dialogue, it pre-selects 'origin' even though the only branch ticked is one branch set to track a different remote. It feels like if you could skip the push dialogue (which I'd like to do as it's pointless anyway), it would work. Or if there was a keyboard shorcut for that right-click menu, it would also work as you could just hit enter to OK the push branches dialogue.

Deleted user March 15, 2017

Thank you, "Tools > Options > Git, the 'Push branches' option should be set to 'upstream'" helped me!

4 votes
D M January 26, 2016

This bug still exists in Sourcetree 2.1, but you can work around it by renaming your preferred push branch to "origin", and then secret sourcetree magic will allow that branch to be the default push branch.

ekloecker2 February 19, 2020

This bug still exists in 2020 version 3.2.1 (Mac), along with many other Sourcetree bugs. Sourcetree feels like abandonware.

Like Elalemanyo likes this
Elalemanyo December 7, 2020

I am also having this issue. I set "pushe Branches" to Upstream on the settings, but if I use the push button on the top I need to check the branch where I want to push.
Why is not setting the current branch as default? I am missing something?
@ekloecker2 did you found a fix?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events