Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,662
Community Members
 
Community Events
184
Community Groups

How do you remove branches from source tree

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.

3 answers

1 accepted

26 votes
Answer accepted
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
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.

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

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???

 

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.

Like # people like this

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?

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

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.

Like Alfred Kutengule likes this

Uh... I'm running SourceTree 3.2.6 and I created a branch. The branch showed up under "Branches" and "Remotes". I right clicked the branch under "Branches" and pressed "Delete <Branchname>".

The branch then proceeded to disappear from both "Branches" and "Remotes", which seemingly means the branch was deleted on the server! Luckily it was a fake branch I had created to test this functionality.

Has this behavior changed? Or am I misunderstanding something? This thread makes me believe that "Delete" under Branches should only delete the local reference... but it also deleted the "Remotes" version.

Just to add a little more info to this thread, this is what happens when you delete a branch from the sidebar. It ASKS for confirmation. You can CHOOSE to delete the remote branch, but the default behavior is to just delete the local one.

For reference, this happens in Sourcetree 4.0.1 although more likely, the functionality is present in previous versions.Screen Shot 2020-06-01 at 23.52.54.png

As someone who switches between Windows and Mac, this option is only available in the Mac version of SourceTree.

I found this thread trying to find out how to have the "Delete Remote Branch" option in the Windows version too.

This is the equivalent dialog in Windows:

Screen Shot 2021-01-12 at 17.01.11 .png

You can delete all local and origin.Capture.PNG

Please see my comment above... If I do this as of 3.2.6 the branch disappears from BOTH Branches and Remotes. This seemingly implies that "Delete <branchname>" actually deletes the branch on the server! Beware!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events