It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How do you remove branches from source tree

Will Ryan Jun 25, 2012

There are a number of old branches that I used to track which I want to remove from source tree. Is this possible? If I right click the branch in the side menu, I can delete the branch, but I'm not sure if this will just remove it from source tree (as I want) of if it will completely delete the branch from the GIT repo.

1 answer

1 accepted

20 votes
Answer accepted
Steve Streeting Jun 26, 2012

If you're using Git, when you delete a branch from the sidebar, if you do it in the local branches section (so ones not under a Remote, they're blue) then the branch will simply be deleted from your local repo. Any branches on remotes will not be affected.

If you want to delete a branch on a remote, you can expand the remote in the sidebar and delete the grey branch underneath. This is a separate task to deleting your purely local branch.

Steve Streeting Jun 26, 2012

Worth saying that if you delete just the local branch, but you've pushed this branch to a remote at some point, you can always get the branch back again locally just by checking it out from the remote again.

Mikael Lavi Sep 24, 2014

Would love it if it was called "Delete local branch", and the corresponding command on remotes be called "Delete remote branch". Thanks for the hint anyways!

Like # people like this
Bill Langton Mar 02, 2016

Same question and same concern over what Delete would do.  With the recent UI update, the local branches are no longer blue.   A picture would be worth the proverbial 1000 words here, but I get an http error when i try to insert an image.  

In the Sidebar, there are bolded sections for File Status, Branches, Tags, Remotes, and Stashes.    Under Branches, right click the branch to remove and choose Delete.  You'll get a confirmation popup with an unchecked checkbox to Force Delete.  I did not check the box.   As noted by Steve, this only removed the branch from my local repo.   I'm guessing Force Delete will remove any local changes???


Daniel Seitz Jun 10, 2016

If the changes in the local branch are not fully merged the action wont delete the local branch. Use the 'Force Delete' Flag for this. It will then delete the local branch only and this still does NOT affect the remote branch. Better naming would be great here.

Jonas Stawski Sep 19, 2017

I have a local branch that was pulled from a remote branch created by someone else. The remote branch has since been deleted and I want to delete my local one as well. When I right click on the local branch the delete option is disabled. How do I get rid of it?

Jonas Stawski Sep 19, 2017

Never mind, I couldn't delete it because I had it checkout. After moving to a different branch the option enabled again

Alex Peter Aug 30, 2018 • edited

I agree that it should have been called "Delete local only" for local branches and "Remove from remote repository" for remote. As these are two actions that can be dangerously confused!!!
If you ask me honestly, i would NOT allow deleting remote branch from Source tree or have a setting for it that is set to NO.
Very bad that I have to read all this before I am sure that it will not do any serious harm.

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

1,840 views 13 17
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you