Skip to content

Instantly share code, notes, and snippets.

View RJPercival's full-sized avatar

Rob Percival RJPercival

View GitHub Profile
@RJPercival
RJPercival / git-clean-branches
Created October 2, 2025 10:51
git-clean-branches
#!/bin/bash
git fetch --prune
git remote prune origin
# Clean up local branches whose upstream has been deleted:
for branch in $(git for-each-ref --format '%(refname) %(upstream:track)' refs/heads | awk '$2 == "[gone]" {sub("refs/heads/", "", $1); print $1}')
do
git branch -D $branch
done
@RJPercival
RJPercival / machine.js
Created December 8, 2020 17:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions