惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - 聂微东
Y
Y Combinator Blog
WordPress大学
WordPress大学
L
LangChain Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
A
About on SuperTechFans
小众软件
小众软件
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
Recent Announcements
Recent Announcements
GbyAI
GbyAI
I
InfoQ
The GitHub Blog
The GitHub Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
C
Check Point Blog
V
V2EX
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
量子位
雷峰网
雷峰网
Hugging Face - Blog
Hugging Face - Blog

Stonecharioteer on Tech

I Traced My Traffic Through a Home Tailscale Exit Node What Was I Reading Last? In Three Not-So-Easy Pieces Dogfooding Is Hard Code blocks in your books, finally GoForGo v0.9.0 Merrilin - We built an app to read books I use a Macbook now Data Structures & Algorithms - Preparing for Interviews Using a local DNS namespace for local service discovery Direction KOllector - Publishing KOReader Highlights gbt: branches touched in the last 24 hours A Soiree into Symbols in Ruby Some Smalltalk about Ruby Loops Ruby Blocks Returning from Ruby Blocks, Procs and Lambdas My Linux Laptop Finally Works: How Claude Helped Me Fix Years of Annoyances TIL: Watchexec - Modern File Watching for Development Workflows A Less Busy Mind GoForGo - Learn Go through live examples Migrating My Old Blog to Hugo with Claude The Qtile Window Manager: A Python-Powered Tiling Experience Read the RFCs that Built the Internet Py-x-Protobuf - Or How I Learned to Stop Worrying and Love Protocol Buffers Python Reverse a List New Beginnings Leaving ChainSafe Systems Screen Lock for Cinnamon Desktop using Zenity and Terminal Commands Crews Not Teams A System for Getting Better at LeetCode
gbt: branches touched in the last 24 hours
2025-12-03 · via Stonecharioteer on Tech

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
function gbt --description 'List git branches updated/created in the last 24 hours'
    git for-each-ref --sort=-committerdate --format='%(committerdate:iso8601) %(refname:short)' refs/heads/ | \
    while read -l date time zone branch
        set -l commit_time (date -j -f "%Y-%m-%d %H:%M:%S %z" "$date $time $zone" +%s 2>/dev/null)
        set -l now (date +%s)
        set -l diff (math $now - $commit_time)
        if test $diff -le 86400
            echo "$date $time $branch"
        end
    end
end

What it does

  • git for-each-ref prints every local branch with its committer timestamp, most recent first.
  • read -l date time zone branch splits 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 +%s for “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:

1
set -l commit_time (date -j -f "%Y-%m-%d %H:%M:%S %z" "$date $time $zone" +%s 2>/dev/null)

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.