ghbranch

command
v0.187.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: BSD-3-Clause Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command ghbranch deletes remote branches, the one repository write that had no fleet program: `gh api -X DELETE .../git/refs/heads/<b>` and `git push --delete` are refused by guard-bash and name this tool.

ghbranch <owner/repo> delete <branch>... [--dry-run] [--force-unlanded]

Every branch is checked BEFORE any is deleted (all or nothing), and a branch is refused when it is

  • the repository's default branch,
  • protected,
  • the head of an open pull request, or
  • unlanded: its head is not contained in a merged or closed pull request from that branch, and is not already reachable from the default branch. --force-unlanded waives only this last check.

After each delete the branch is read back and must answer 404.

The token is read from a 0600 file and sent only in the Authorization header, over https, with redirects refused.

References (read 2026-11-28):

https://docs.github.com/en/rest/branches/branches#get-a-branch    GET /repos/{o}/{r}/branches/{b}: 200 {protected, commit.sha}, 404
https://docs.github.com/en/rest/pulls/pulls#list-pull-requests    GET /repos/{o}/{r}/pulls?state=all&head={o}:{b}: number, state, merged_at, head.sha
https://docs.github.com/en/rest/commits/commits#compare-two-commits GET /repos/{o}/{r}/compare/{base}...{head}: status ahead|behind|identical|diverged
https://docs.github.com/en/rest/git/refs#delete-a-reference       DELETE /repos/{o}/{r}/git/refs/heads/{b}: 204, 422

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL