I keep too many branches alive when I’m working on Chatwoot. A day later I
forget the exact names and end up grepping through git branch output. I wrote
a tiny helper in Fish to show me the branches I touched in the last 24 hours:
|
|
What it does
git for-each-refprints every local branch with its committer timestamp, most recent first.read -l date time zone branchsplits that line into pieces so I can get the timestamp and branch name cleanly.date -d "$date $time $zone" +%s(GNU date on Linux) turns the ISO timestamp into epoch seconds.- I subtract that from
date +%sfor “now” and keep anything under 86,400 seconds—24 hours. - The output is a short list I can scan:
macOS note
The BSD date on macOS doesn’t support -d. Swap the commit_time line for:
|
|
Or brew install coreutils and use gdate -d "$date $time $zone" +%s to match
the Linux version. Everything else stays the same.
$ gbt
2025-08-26 19:14:55 cx-app-perf
2025-08-26 10:02:07 fix-shift-threads
2025-08-26 08:41:33 remove-old-flows
That’s enough to remind me where I should jump back in, and it’s a good nudge that I probably need to graduate these into separate worktrees soon.