glab(1)

πŸ“¦
version 1.128.0 Β· 3 versions
, in arch rolling

πŸ’– NAME πŸ’–

glab-repo-prune β€” delete local Git branches whose merge request has been merged.

okay so welcome to the glab(1) manual, bestie β€” we're zooming in on glab repo prune, aka the branch-cleanup icon. ✨

🌸 SYNOPSIS 🌸

glab repo prune [flags]

πŸ¦‹ DESCRIPTION πŸ¦‹

Delete local Git branches whose merge request has been merged on GitLab. That's the whole vibe πŸŽ€.

By default, the command queries GitLab for each local branch and only deletes branches that have at least one merged merge request and no merge requests still open from the same source branch. no cap.

Protected branches, the default branch, and the currently checked-out branch are never deleted. periodt. πŸ›‘

This command only affects your local Git repository. Remote branches on GitLab are not touched β€” local only, iykyk. Your local repo is the main character here πŸ’….

Use --merged to skip the per-branch merge request lookup and instead rely on git branch --merged to decide which branches to delete. The default branch and protected branches are still fetched from GitLab in this mode. Falling back to Git is faster, but only detects fast-forward merges β€” squash and rebase merges look like distinct commits to Git and will not be reported as merged.

heads up bestie: --merged is the speedy route, but it misses squash and rebase merges. Don't let that catch you slipping πŸ’€.

✨ OPTIONS ✨

  • --dry-run[=false] β€” preview branches that would be deleted without deleting them. lowkey the peek-first move πŸ‘€
  • -e, --exclude=[] β€” branch name or glob pattern to exclude. Comma-separated or repeated.
  • --merged[=false] β€” use git branch --merged instead of querying GitLab. Detects fast-forward merges only.
  • -y, --yes[=false] β€” skip the confirmation prompt. say less and let it cook πŸ”₯

🫢 OPTIONS INHERITED FROM PARENT COMMANDS 🫢

  • -h, --help[=false] β€” show help for this command. literally here to help 🫢

πŸ“ EXAMPLE πŸ“

# Preview branches that would be deleted
glab repo prune --dry-run

# Delete branches with merged MRs (after confirmation)
glab repo prune

# Delete without confirmation
glab repo prune --yes

# Exclude additional branches by name or glob pattern
glab repo prune --exclude wip-*,demo-branch

# Detect merged branches with Git instead of GitLab (faster, but misses squash and rebase merges)
glab repo prune --merged

🌈 SEE ALSO 🌈


mwah πŸ’‹ this page was Auto generated by spf13/cobra, dated Nov 2026, and it's part of the glab(1) manual β€” byeee bestie πŸŽ€

πŸ“¦ where this page comes from