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 are branches where both of the following are true:

  1. All of the branch's commits have been integrated into its parent branch.
  2. The branch was tracking a remote branch that has since been deleted on the remote.

If this sounds familiar, it's because it's exactly what happens after a pull request is merged: the feature branch gets merged into the base branch and deleted on the remote, leaving your local copy behind. After your next fetch, Tower spots these leftover branches and marks them as fully merged.

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.

Quick Cleanup with the Hint View

Selecting a branch that's flagged as fully merged or stale opens a hint view above the commit history, giving you a quick, one-click option to delete the branch—no need to hunt through menus.

Hint view for a fully merged branch with a one-click option to delete it
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.