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 can I hide Mercurial closed branches in SourceTree?

When I close a branch it disappears from the sidebar, but still shows up in the graph. How can I remove my closed branches from the graph? I know I can view just the current branch, but that's not what I want. I'd like to be able to see all open branches without old, closed ones cluttering up the graph.

3 answers

This is pretty old thread as I see, but is there a solution? I've just updated SourceTree from version 1.7 to 2.1.2.4 and it shows every branch ever made. How it can be solved? Except the downgrading back to 1.7, the most stable one?

Same issue in 2.1.2.5.  Just appeared after updating.

I've downgraded to 2.0.20.1. It does not have this bug.

Its a bug introduced in the latest releases.  Look up their ticket SRCTREEWIN-7189 and upvote it.

Also have this problem on Windows. Voted in the SRCTREEWIN-7189 ticket: https://jira.atlassian.com/browse/SRCTREEWIN-7189

 

So everytone, please vote in this ticket too. Hope this bug will be fixed soon.

"Closing a branch" is not primary a terminology from git itself but rather from branch workflows like gitflow (I assume you are using gitflow within sourcetree,,,).

A  branch in git is simply a lightweight movable pointer on a commit - nothing else. The gitflow-term "closing a branch" consists of two elementary git-steps: 1.) merging the commits (to which the branch pointer currently points to - and previously has been pointing to) into another commit and 2.) removing the pointer. After "closing the branch" the commits (on the "deleted" branch) still exist (they HAVE to exist as hey are part of your commit history - and you surely don't want git to remove anything of your commit history ...) - and only thepointer is removed. That's what you see when looking on the graph.


see:


If you want to cleanup your commit history when merging a branch you have to use more advanced commands like a "squash merge" (on merge all commits of the branch are summarized into one single commit - and this single commit is incorporated into your destination branch (i.e the commit to which the pointer with your destination branchname points to) - all the commits on your branch are removed). Another git command to rewrite your commit history is git rebase.


see:


Be aware that those advanced git concepts are rewritng your commit history - which is always a bad idea if you have previously pushed the commits  ... (you have to perform a "forced push" then - which is considered as evil by many people (http://willi.am/blog/2014/08/12/the-dark-side-of-the-force-push/)

 

 

SUMMARY: "Closing a branch" does not change your commit history - that's what you currently complain about and what you see in your graph.The branch pointer is simply removed - therefore you don't see it anymore in the sourcetree sidebar - and your commits are merged. If you want to modify the commit history, you have to use more advanced git commands - and be aware of potential risks when rewriting an already pushed commit history!!! 

 

Thanks for the detailed answer, but my question is in regards to Mercurial (which does have a "close branch)" function), not Git.

Like Jeremy_Camplin likes this

No idea about mercurial - sry. Should have read your question better ... ;-)

I've the same need as Shawn. I've about 50 closed branches (Mercurial) that I want to be got rid of. Could someone answer, please?

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,927 views 0 12
Read article

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