Lewati ke konten utama

Cleaning Branches

Cleaning Branches

Destructive Maintenance

Pilih branches melalui explicit prefix, merge-state, dan optional age filters sebelum permanent Git deletion.

Commandcusty cleanup branches

Category

User Guide

Quick Command

custy --dry-run cleanup brancheses [OPTIONS]

local branchesremote branchespreview required

Tujuan

Gunakan branch cleanup untuk deliberate repository maintenance setelah merged atau stale work tidak diperlukan. Active CLI subcommand bersifat plural: custy cleanup branches.


Cara Branch Menjadi Eligible

Semua Applicable Filters Harus Lolos

Protected Name

main, master, dan develop dikecualikan oleh active request defaults.

Configured Prefix

Branch harus diawali salah satu explicit prefixes. Empty prefixes tidak memilih apa pun.

Merge State

Branch harus cocok dengan merged, unmerged, atau all sesuai resolved policy.

Optional Time Filter

Gunakan maximum age atau absolute before date, jangan keduanya.

Recommended Cleanup Journey

Review Before Deletion

1
Fetch and inspect repository state
Refresh remote knowledge dan review local serta remote branches manually.
completed
2
Choose narrow prefixes
Pilih known branch families seperti feature/ atau release/.
completed
3
Choose merge and time filters
Pilih merged branches dan tambahkan satu optional age boundary bila perlu.
completed
4
Dry-run the exact command
Review setiap candidate dan skipped branch sebelum normal execution.
current
5
Execute and verify
Jalankan normally, lalu konfirmasi local dan remote branch lists.
pending
Narrow merged-branch cleanup
bash
git fetch --all --prune
git branch --all

custy --dry-run cleanup brancheses --prefix feature/ --merge-status merged --max-age 30d

Pada PowerShell, letakkan command dalam satu line atau gunakan PowerShell continuation syntax, bukan Bash backslashes di atas.

Before Normal Execution

Before You Begin

  • Candidates are listedRequired

    Setiap branch hasil dry-run sesuai harapan dan recoverable bila diperlukan.

  • Protected work is pushedRequired

    Important commits tersedia dalam safe branch, tag, atau reviewed remote location.

  • Merge status is appropriateRequired

    Hindari unmerged atau all kecuali deletion memang dimaksudkan.

  • Only one time filter resolvesRequired

    max_age dan before mutually exclusive.

  • Remote deletion is acceptableRequired

    Konfirmasi matching origin branches dapat ikut dihapus bersama local branches.

Execute and verify
bash
custy cleanup branches --prefix feature/ --merge-status merged --max-age 30d
git branch --all

Jika Wrong Branch Terhapus

Hentikan cleanup tambahan. Jika last commit SHA diketahui dan object masih tersedia locally, buat ulang local branch dengan standard Git recovery tools, review, lalu push hanya jika remote branch juga perlu dipulihkan. Jika commit tidak diketahui, periksa reflog dan repository-host history. Recovery bersifat manual karena Custy tidak menyimpan branch deletion undo journal.

Lanjutkan