Create new branch from tag in Sourcetree

Hi @all,

creating a new branch from a tag is one of my most used git operations.

$ git checkout -b new_branch tag_name

How can I do this with sourcetree? Just right-klick on a tag name on the left pane dosen't give me this option ...

1 answer

1 accepted

3 votes
Accepted answer

When you (left) click on a tag in the sidebar it'll navigate to that point in the log. You can right-click on this commit in the log (indeed, on any commit) and select 'Branch...' to create a branch from that point.

Ah top! Thank you!

WHen i do this and try to push that branch up to origin i get this error git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --set-upstream origin 19.0:19.0 Pushing to http://gitlab.xxxx.com/engineering/xxx.git error: src refspec 19.0 matches more than one. error: failed to push some refs to 'http://gitlab.xxxx.com/engineering/xxx.git'; Completed with errors, see above.

This is only part of the answer.  The method described above, branches only at the SHA.  Does not have an option for tracking.  Because Windows version (not sure about MAC) has an issue with "greyed" out tracking screen (will it ever git fixed :-)), there is a manual step of tracking the branch to the remote that can be done in the terminal shell.

git branch -u origin/<remote branch name> <local branch name>

This is for the case of an existing branch that is on the remote.

BTW - I have version 2.4.8.0 of Sourcetree - when in the remote list on the left, right clicking does allow branch creation with tracking option.  This seems to answer the original post.  One thing that is missing from that process, is that there is no option for not checking out the branch.  If the checkout is done, at least tracking is available (not greyed out) .  Wish the two branch dialogs were consistent.  There are times when it is inconvenient to do a checkout, but still want to setup a local branch on the remote.  As for the tracking menu issue/bug/feature, that is another story.

PS - Just noticed that this was talking about tags (no children) ... my response was for an existing branch ...  still very similar..

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

841 views 3 2
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