Why are all branches selected by default in SourceTree when pushing?
Asked by Jeremy Glazman:

When pushing changes to a branch of a git repository via SourceTree, by default all possible branches are selected:

![](../../upfiles/sourcetree_push_2.png)

Is this intentional? Shouldn't it just default to pushing the branch I currently have checked out?

There's a "Select All" button right there which is toggled off by default, so shouldn't the default selection NOT be to have everything selected? Clicking on "Select All" actually does nothing, because everything is already selected. This makes me think this behaviour is not intentional.


Answers:
author: stevestreeting
body: Paul's right, it actually pre-selects based on the default behaviour of 'git push' without any parameters. This is based on the default behaviour of git, which is that the 'push.default' setting is 'matching' (branches called the same thing on local and remote).

However, in 1.5 I've added support for other values of 'push.default', and exposed these in the Git Preferences tab. So now you can opt for:

matching = push all branches which have same named counterparts on the remote  
current = push the current branch only to a branch called the same thing on the remote  
upstream = push the current branch to the branch it is tracking (if any) on the remote (may be a different name)  
nothing = push nothing by default

When you alter this setting, the default checked boxes in the top-level Push dialog change to reflect this. You can get the beta for 1.5 now if you like: <http://blog.sourcetreeapp.com/2012/07/06/sourcetree-1-5-beta-1/>

comments: author: Christopher Forbes
body: The default setting in SourceTree should be current or upstream. I'm using a GUI for git for a reason; so things are easier and so you help me mess things up less. Just screwed over another branch because the branch was checked by default. Just went and bought a copy of Tower this morning. Super disappointed with dumb design decisions in SourceTree.


author: Russell Trafford
body: Christopher, I disagree. Default setting should be what 'git push' does 'by default' without parameters and no gui.

Surely you can be 'super dissapointed' and move away from the product on just this one aspect, especially if it has been addressed and config options given to change it. I think there must be other things you are annoyed about with Sourcetree, cant just be that.

Anyway, I do however think that this feature needs to be labelled more clearly in the config. I looked on this exact page for this feature, and couldnt find it, I had to do a double take when I saw this post via google, and finally figured it out.

Sourcetree Devs: Please rename "Push Branches" to "Default Push Branch behaviour"  
OR

"Branches to be pushed by default"

and then an option for explanation of each, as they are not immediately clear.

**But either way "Push Branches" is way too unclear.**


author: Christopher Forbes
body: Thank you for the comments but I respectfully disagree. Please read in full [The Power of Defaults](http://blog.codinghorror.com/the-power-of-defaults/)


author: Paul Curren
body: I saw this same question answered very recently but can't find the question. I'll have a go from what I remember.

Basically, push on the toolbar is equivalent to 'git push' with no further detail specified. Which is to say it will default to pushing every branch you are tracking.

If you only want to push a single branch you should right click on that branch itself and select to push.

comments: author: Jeremy Glazman
body: Yes, that appears to be it! Thanks!


Tags: git

push