Hi, the turndown arrow by the BRANCHES item in the left sidebar disappeared, and branches are no longer showing, when I reached about 300 local branches in Sourcetree. It reappeared when I deleted the newly added branch that caused the issue. Note that about 1500 remote branches show fine. I suspect that Sourcetree has a hardcoded limit for the number of branches, that may need to be raised substantially or preferably removed.
I found this question demonstrating a similar issue with a subfolder:
And posted this comment for a similar issue on Stack Overflow:
I'm on Sourcetree 4.2.8 (265) on macOS 13.5 Ventura with system git 2.39.3.
Edit: a workaround is to click the lower left filter box in the sidebar and type something like "-", "_" or " " that appears in the name of relevant branch(es), then View->Filter in Sidebar to reduce the number of branches shown to less than 300.
Otherwise you'll have to painstakingly delete local branches to get below 300, which is such a pain that I'll leave some commands to help with that:
# delete merged and pushed branch
#
# list merged and pushed branches, oldest first, <trunk> optional
git branch --sort=committerdate --merged <trunk> | cat
# list unmerged branches, oldest first, <trunk> optional
git branch --sort=committerdate --no-merged <trunk> | cat
# get last commit on branch
git log '<branch_name>'^..'<branch_name>'
# find branch containing commit
git branch --contains <commit>
# find branch root
git rev-list $(git rev-list --first-parent ^'<branch>' '<trunk>' | tail -n1)^^!
# find branch merge commit
git rev-list '<branch>'..'<trunk>' --ancestry-path --merges | tail -1
# get merge commit parent on trunk
git show <merge_commit>^1
# get merge commit parent on branch
git show <merge_commit>^2
#
# delete branch only if it's merged
git branch -d '<branch>'
# undelete branch, might have seen "Deleted branch <branch> (was <last_commit_on_branch_before_merge>)"
git checkout -b '<branch>' <last_commit_on_branch_before_merge>
Note that if you deleted a branch and wish to undelete it, you can find the branch in a remote repository like Bitbucket, GitHub or GitLab. Then find the last commit on the branch before its merge commit and use the undelete branch command above to recreate it locally.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.