Why are all branches selected by default in SourceTree when pushing?

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

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.

2 answers

1 accepted

Accepted Answer
17 votes

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/

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.

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.

Thank you for the comments but I respectfully disagree. Please read in full The Power of Defaults

1 vote
Paul Curren Atlassian Team Jul 06, 2012

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.

Yes, that appears to be it! Thanks!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Featured Groups

Tuesday tips & tricks: What is the Atlassian Community?

It's officially Tuesday, which means it's officially time for another tip to help you better navigate this space we call the Atlassian Community. 😄 I got a great question from community member, Sa...

25 views 0 2
View post

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you