Is "Push commits immediately" working fine when a local branch is tracking a remote branch with a different name?

Hello,

Maybe I am wrong and this is the desired behavior, but I think the "Push commits immediately to" is not working fine when you have a local git branch tracking a remote branch with a different name.

In this case when you commit ant check the "Push commits immediately to" I was expecting that my commit will be pushed to the followed remote branch (remember with a different name than the local one), but instead a new remote branch is created with my local name at origin. Is this the expected behavior or is this a bug?

Thanks,

Ramiro

2 answers

1 accepted

I've recently started renaming my local branches to be more descriptive of which issue I'm tracking. When you commit, and then use the "Push immediately to..." function, it wants to create a remote branch with the same name. This is quite bad, as it has completely made me look like a noob the past couple days as I was committing away without first checking.

If you right-click on the branch in the sidebar, you can select the "Push to [...] (tracked)" option. It seems pretty inconsistent. At the very least there should be another checkbox in the commit window that allows us to choose to push to the tracked branch, or a branch named the same as our local branch.

To fix the issue so that the commit window always uses your tracked branch, you can go to

Preferences > Git > Set "Push branches" to "upstream"


This solves the problem.

I noticed also (at least now, not sure if this was also true with the latest sourcetree version when I posted the question) that you can be sure before the commit where the changes will be pushed because the message near the checkbox tells you...

Push changes immediately to branchName

And you can see that branch name changes from your local one to the remote one when changing the configuration like xaero indicated.

Thank you very much.

It is not working fine. For sure the most intuitive behavior is to push immediately to the tracked branch instead of creating another branch with the same name.

It's a very annoying bug indeed.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

274 views 0 3
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot