Automatic Branch Management

As your repository grows and your team completes more work, the number of branches in your sidebar can quickly become overwhelming. Old feature branches that were merged months ago, experimental branches you forgot about, and outdated work-in-progress branches all clutter your sidebar, making it harder to find the branches you actually need.

Tower's automatic branch management helps you maintain a clean, organized repository by identifying branches that are no longer actively needed and providing simple tools to archive them.

Why Automatic Branch Management Matters

A cluttered sidebar isn't just an aesthetic problem — it impacts your productivity and team collaboration. When dozens of obsolete branches fill your sidebar, it becomes difficult to:

  • Find the active branches you need to work with
  • Understand which branches represent current work
  • Identify potential conflicts or problems with active development
  • Maintain a clear overview of your project's structure

Automatic branch management solves these problems by intelligently detecting branches that are candidates for archiving, marking them clearly in your sidebar, and providing streamlined workflows to organize them. This keeps your working environment focused on what matters while preserving the branches in case you need them later.

How Tower Detects Archivable Branches

Tower automatically analyzes your branches to identify two specific categories that typically signal a branch is no longer actively needed:

Stale branches haven't received any commits for an extended period. These are branches where development has stopped, often because the work was abandoned, put on hold indefinitely, or simply forgotten. While a stale branch isn't necessarily ready to be archived — you might plan to return to it — it's a strong signal that the branch may no longer be relevant to your current work.

Fully merged branches contain work that has already been integrated into another branch in your repository. When a branch is fully merged, keeping it active in your sidebar serves little purpose since all its changes already exist elsewhere. These branches are prime candidates for archiving to reduce clutter.

Detecting a fully merged branch used to be straightforward — until squash and rebase merges entered the picture. When a pull request is merged this way, the commits that land on the base branch are different from the commits on your local branch. Since plain Git compares commits directly, it will always report the branch as unmerged, even though its work was integrated long ago. This is exactly what leads to repositories cluttered with "just in case" branches that nobody feels confident deleting.

To solve this, Tower runs four independent checks to determine whether a branch is truly fully merged:

  • Git's Merge Detection: the classic check: all of the branch's commits have been integrated into its parent branch.
  • Merged Pull Requests: Tower matches your local branches against merged pull requests from your connected hosting service, such as GitHub or GitLab, reliably catching squash and rebase merges that Git alone can never see.
  • Merge Commit Analysis: Tower inspects merge commits for the branch's name and matching timestamps.
  • Deleted Remote Tracking Branches: the branch was tracking a remote branch that has since been deleted, the typical leftover of a merged pull request.

A branch only needs to match one of these checks to earn its "Merged" badge, so Tower's detection covers everything from classic local merge commits to squash-merged pull requests whose remote tracking branches are long gone.

Tower Pro Feature Detecting merged branches through merged pull requests is available in Tower Pro. All other "Fully Merged" checks work in every edition.

Tower continuously monitors your branches for these conditions, updating their status as your repository evolves. This means you always have current information about which branches might be ready for archiving.

Sidebar Badges for Stale and Merged Branches

When Tower detects that a branch is stale or fully merged, it displays a special badge next to the branch in the Branches section of the sidebar. These visual indicators make it immediately clear which branches are candidates for archiving without requiring any additional clicks or navigation.

"Fully Merged" and "Stale" badges next to branches in the sidebar

A Stale badge also tells you at a glance how long the branch has been inactive, so you can quickly judge whether it's safe to clean up.

Two branches carrying the "Merged" badge in the sidebar, one of them detected through a merged pull request

The "Fully Merged" Hint View

Trust matters when you're about to delete a branch, so Tower doesn't just show a badge and leave you guessing. Selecting a fully merged branch opens a hint view above the commit history that shows exactly which of the four checks matched for that branch. From here, you can archive or delete the branch with a single click — no need to hunt through menus.

The "Fully Merged" hint view listing the matched checks, with buttons to archive or delete the branch

The hint view also includes direct links to the merge commit or the merged pull request responsible for the match. With a single click, you can jump straight to that evidence in your Git history or on your hosting service and verify everything before hitting delete.

The "Fully Merged" hint view linking to the merge commit that references the branch

If you'd rather keep a specific branch around and stop seeing "Fully Merged" hints for it, right-click the branch in the sidebar and enable Hides Fully Merged Hint from the context menu. Tower will then stay quiet about that particular branch, no matter how many checks it matches.

The "Hides Fully Merged Hint" option in a branch's context menu

Hides Fully Merged Hint vs. Skips Auto-Archiving Hides Fully Merged Hint only suppresses the "Fully Merged" hint for that branch. If you also want to prevent it from being archived automatically, use Skips Auto-Archiving, as described in Flagging Branches to Skip Auto-Archiving.

The "Stale" Hint View

Similarly, selecting a stale branch opens a hint view that gives you a quick, one-click option to delete the branch.

Hint view for a stale branch with a one-click option to delete it

Archiving Branches to Clean Up Your Sidebar

When you identify branches that you want to remove from your main sidebar view but aren't ready to delete permanently, archiving provides the perfect solution. Archiving a branch moves it into a special Archived Branches view, which keeps your sidebar clean while preserving the branch for future reference.

You can archive a branch in two ways:

  • Right-click it in the sidebar and select Archive Branch from the context menu.
  • Drag and drop it directly onto the Archived Branches section.

Both methods support multi-select, so you can select several branches at once and archive them all in a single action.

Archiving multiple selected branches at once via the context menu

If you need to access an archived branch later, simply expand the Archived Branches view — all the branches remain fully functional and can be checked out, merged, or otherwise worked with just like any other branch.

Making Archiving Decisions If you're unsure about archiving a branch, remember that archiving is reversible. Archived branches remain in your repository and can be easily accessed through the Archived Branches view if you need them later.

The Archive Branches Dialog

Once Tower has identified archivable branches, a notification number appears in the sidebar's footer. Clicking it opens the Archive Branches dialog, which presents all candidate branches in one organized list.

The Archive Branches dialog listing branches flagged as Fully Merged or Stale

In this dialog, you can quickly scan through the suggested branches, select the ones you want to archive, and process them all with a single action. This bulk operation is far more efficient than archiving branches one by one, especially when you're doing periodic maintenance on a repository with many completed feature branches.

Each branch in the list shows why it was suggested for archiving — whether it's stale, fully merged, or both — helping you make informed decisions. You can select all branches, pick specific ones, or skip any that you want to keep active in your main sidebar.

Automatic Archiving for Hands-Free Maintenance

For an even more hands-off approach, Tower can identify and archive candidate branches for you automatically. Next to the notification number in the sidebar's footer, you'll find a gears icon that opens Tower's archiving settings.

Settings for the interval that defines when a branch becomes stale

Here you can enable Automatically Archive Branches and set the Stale Branch Time Interval that defines when a branch is considered stale, from 1 month up to 24 months. The same menu also lets you toggle the sidebar badges individually via Show Fully Merged Badge in Sidebar and Show Stale Info in Sidebar.

Automatic archiving is particularly valuable for:

  • Large repositories with frequent branch creation
  • Teams where many developers create feature branches
  • Projects with long development cycles where branches naturally become stale
  • Anyone who prefers a hands-off approach to repository maintenance

Even with automatic archiving enabled, you maintain full control over which branches are managed automatically — see the sections below.

Pinned Branches Are Always Safe

Any branch you've pinned is automatically excluded from automatic archiving, no matter how stale it becomes or whether it's fully merged. This makes pinning a simple way to guarantee that a branch always stays visible in your main sidebar.

Workflow Integration and Protected Branches

If you're using Tower's Custom Git Workflows feature, you'll appreciate that automatic branch management integrates intelligently with your workflow configuration. Base branches that you've configured through Tower Workflows are automatically protected from archiving — they will never be flagged as archivable or automatically archived, even if they technically meet the criteria.

This protection makes sense because workflow base branches like main, develop, staging, or custom long-lived branches represent foundational elements of your development process. They should remain visible and accessible in your sidebar at all times, regardless of when they last received commits or their merge status.

Tower recognizes these branches based on your workflow configuration and excludes them from all automatic branch management operations. You can work confidently knowing that your carefully configured workflow structure won't be disrupted by branch archiving.

Flagging Branches to Skip Auto-Archiving

Sometimes you have branches that meet the technical criteria for archiving — they're stale or fully merged — but you want to keep them visible in your main sidebar without pinning them. Perhaps it's a branch you reference frequently, a template you use for new work, or simply a branch you prefer to keep easily accessible for personal workflow reasons.

For these situations, you can explicitly flag any branch to skip auto-archiving. Right-click the branch in your sidebar and enable Skips Auto-Archiving from the context menu.

The "Skips Auto-Archiving" option in a branch's context menu

Once flagged, Tower will never automatically archive this branch, even with automatic archiving enabled. You can flag and unflag branches at any time as your needs change, providing flexibility while still benefiting from automatic management for the majority of your branches.

Use Cases for Skips Auto-Archiving Common scenarios include reference branches, template branches you copy for new features, branches for documentation or examples, and any branch tied to a specific external process or requirement.

Unarchiving a Branch

If you need a branch back in your main sidebar, right-click it in the Archived Branches view and select Unarchive [BRANCH]. The branch immediately moves back to the Branches section, ready to be worked with as usual.

The "Unarchive" option in an archived branch's context menu

As you work with this feature, you'll develop a workflow that suits your needs — whether that's periodic manual archiving, fully automatic archiving, or a hybrid approach where you manually review suggestions while relying on automation for obvious cases.

By keeping your sidebar clean and organized, automatic branch management helps you focus on your current work while ensuring historical branches remain accessible when needed. It's branch hygiene made simple.