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

推荐订阅源

Google DeepMind News
Google DeepMind News
I
InfoQ
Engineering at Meta
Engineering at Meta
D
DataBreaches.Net
L
LangChain Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Recent Announcements
Recent Announcements
GbyAI
GbyAI
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
腾讯CDC
美团技术团队
罗磊的独立博客
Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
T
The Blog of Author Tim Ferriss
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
M
MIT News - Artificial intelligence
D
Docker
MongoDB | Blog
MongoDB | Blog
F
Fortinet All Blogs
博客园 - 叶小钗

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.