Illustration of Emily presenting the Archive Branches Helper, a Git tool for archiving branches, depicting a tidy

Welcome to another installment of "TWIL," our weekly series where we share bite-sized insights into complex topics learned by our tech-savvy team. This week, Emily brings us a nifty Git tool for maintaining a tidy version control environment. Dive into her guide on creating an Archive Branches Helper, a shell command for efficiently archiving old Git branches, ensuring thorough housekeeping of your local and remote repositories without manual hassle. Keep your coding workspace clean and collaborate with ease, thanks to this clever shortcut.

Archive Branches Helper

Cleaning up old working branches is a great way to declutter both your local and remote repositories. But doing so can be tedious given all the steps required to maintain consistency between local and remote. Usually, you have to:

  1. tag the branch
  2. remove it locally
  3. remove it on remote
  4. push the tag to remote

So I wrote a shell command to do it for you! The archive-branch command is designed to archive a old git branches efficiently. This command ensures the branch is neatly archived and the repository remains organized.

# Archive a branch
# - Tag the branch as archived
# - Remove the branch locally
# - Remove the branch on origin
# - Push tag to remote
function archive-branch () {
  git tag archive/"$@" "$@" && git branch -D "$@"; git push origin :"$@"; git push origin archive/"$@"
}

In essence, a command like archive-branch contributes to a more manageable, understandable, and clean repository, which is fundamental for effective collaboration and project maintenance.

  • Git
Emily Morehouse's profile picture
Emily Morehouse

Cofounder, Director of Engineering

Related Posts

AWS logo centered over dark blue stylized map of Europe with concentric radar-style rings emanating from Germany, representing the AWS European Sovereign Cloud infrastructure launch for EU data sovereignty and GDPR compliance
January 26, 2026 • Frank Valcarcel

AWS Launches European Sovereign Cloud

AWS launched a physically separate cloud infrastructure in Europe with EU-only governance, zero US dependencies, and over 90 services. Here is what organizations in healthcare, finance, and government need to know about the sovereign cloud and how to evaluate it for their compliance strategy.

MCP (Model Context Protocol) logo — a stylized white interlinked letter mark — centered on an abstract background of flowing purple and orange gradient waves, representing AI connectivity and data integration.
November 25, 2025 • Frank Valcarcel

Anthropic’s Model Context Protocol: The Standard for AI Tool Integration

A year after launch, Anthropic’s Model Context Protocol has become the universal standard for connecting AI agents to enterprise tools. Backed by OpenAI, Google, Microsoft, and the Linux Foundation. Here’s what developers need to know.

Let's work together

Tell us about your project and how Cuttlesoft can help. Schedule a consultation with one of our experts today.

Contact Us