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.

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

570 views 1 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