Y
HN HRCB new | past | comments | ask | show | by right | domains | dashboard | about hrcb
+0.01 I found a useful Git one liner buried in leaked CIA developer docs (spencer.wtf)
705 points by spencerldixon 4 days ago | 255 comments on HN | Neutral Editorial · vv3.4 · 2026-02-24
Article Heatmap
Preamble: -0.05 — Preamble P Article 1: +0.05 — Freedom, Equality, Brotherhood 1 Article 2: 0.00 — Non-Discrimination 2 Article 3: 0.00 — Life, Liberty, Security 3 Article 4: 0.00 — No Slavery 4 Article 5: 0.00 — No Torture 5 Article 6: 0.00 — Legal Personhood 6 Article 7: 0.00 — Equality Before Law 7 Article 8: 0.00 — Right to Remedy 8 Article 9: 0.00 — No Arbitrary Detention 9 Article 10: 0.00 — Fair Hearing 10 Article 11: 0.00 — Presumption of Innocence 11 Article 12: -0.47 — Privacy 12 Article 13: 0.00 — Freedom of Movement 13 Article 14: 0.00 — Asylum 14 Article 15: 0.00 — Nationality 15 Article 16: 0.00 — Marriage & Family 16 Article 17: 0.00 — Property 17 Article 18: 0.00 — Freedom of Thought 18 Article 19: +0.37 — Freedom of Expression 19 Article 20: +0.05 — Assembly & Association 20 Article 21: 0.00 — Political Participation 21 Article 22: 0.00 — Social Security 22 Article 23: 0.00 — Work & Equal Pay 23 Article 24: 0.00 — Rest & Leisure 24 Article 25: 0.00 — Standard of Living 25 Article 26: +0.13 — Education 26 Article 27: +0.23 — Cultural Participation 27 Article 28: 0.00 — Social & International Order 28 Article 29: 0.00 — Duties to Community 29 Article 30: 0.00 — No Destruction of Rights 30
Negative Neutral Positive No Data
Aggregates
Weighted Mean +0.01 Unweighted Mean +0.01
Max +0.37 Article 19 Min -0.47 Article 12
Signal 31 No Data 0
Confidence 43% Volatility 0.12 (Low)
Negative 2 Channels E: 0.6 S: 0.4
SETL +0.14 Editorial-dominant
Evidence: High: 0 Medium: 4 Low: 3 No Data: 24
Theme Radar
Foundation Security Legal Privacy & Movement Personal Expression Economic & Social Cultural Order & Duties Foundation: 0.00 (3 articles) Security: 0.00 (3 articles) Legal: 0.00 (6 articles) Privacy & Movement: -0.12 (4 articles) Personal: 0.00 (3 articles) Expression: 0.14 (3 articles) Economic & Social: 0.00 (4 articles) Cultural: 0.18 (2 articles) Order & Duties: 0.00 (3 articles)
Domain Context Profile
Element Modifier Affects Note
Privacy -0.15
Article 12
Google Analytics tracking (gtag) present on page; non-transparent data collection signal
Terms of Service
No observable ToS or terms engagement on page
Accessibility
No accessibility barriers observable; code highlighting available
Mission
Personal technical blog; no formal mission statement observable
Editorial Code
No editorial code or ethical standards observable on-domain
Ownership
Individual author (Spencer Dixon) clearly identified; personal domain
Access Model +0.10
Article 19 Article 27
Open access to content; no paywall or registration required
Ad/Tracking -0.10
Article 12
Google Analytics tracking present; structural signal of user data collection
HN Discussion 19 top-level comments
whazor 2026-02-20 14:20 UTC link
I currently have a TUI addiction. Each time I want something to be easier, I open claude-code and ask for a TUI. Now I have a git worktree manager where I can add/rebase/delete. As TUI library I use Textual which claude handles quite well, especially as it can test-run quite some Python code.
parliament32 2026-02-20 14:24 UTC link
So effectively "I just discovered xargs"? Not to disparage OP but there isn't anything particularly novel here.
sigio 2026-02-20 14:27 UTC link
I've had this command as 'git drop-merged' for a few years now (put as a script in your path named git-drop-merged:

  #!/bin/sh
  git branch --merged | egrep -v "(^\*|master|main|dev)" | xargs --no-run-if-empty
  git branch -d
arusahni 2026-02-20 14:39 UTC link
I use this alias:

    prune-local = "!git fetch -p && for branch in $(git branch -vv | awk '/: gone]/{if ($1!=\"\*\") print $1}'); do git branch -d $branch; done"
1. Fetch the latest from my remote, removing any remote tracking branches that no longer exist

2. Enumerate local branches, selecting each that has been marked as no longer having a remote version (ignoring the current branch)

3. Delete the local branch safely

gritzko 2026-02-20 14:40 UTC link
Speaking of user friendliness of git UI. I am working on a revision control system that (ideally) should be as user friendly as Ctrl+S Ctrl+Z in most common cases. Spent almost a week on design docs, looking for feedback (so far it was very valuable, btw)

https://replicated.wiki/blog/partII.html#navigating-the-hist...

jo-m 2026-02-20 14:43 UTC link
I have something similar, but open fzf to select the branches to delete [1].

    function fcleanb -d "fzf git select branches to delete where the upstream has disappeared"
        set -l branches_to_delete (
            git for-each-ref --sort=committerdate --format='%(refname:lstrip=2) %(upstream:track)' refs/heads/ | \
            egrep '\[gone\]$' | grep -v "master" | \
            awk '{print $1}' | $_FZF_BINARY --multi --exit-0 \
        )

        for branch in $branches_to_delete
            git branch -D "$branch"
        end
    end
[1]: https://github.com/jo-m/dotfiles/blob/29d4cab4ba6a18dc44dcf9...
lloeki 2026-02-20 14:45 UTC link
I've had essentially that - if a bit fancier to accept an optional argument as well as handle common "mainline" branch names - aliased as `git lint` for a while:

    [alias]
        lint = !git branch --merged ${1-} | grep -v -E -e '^[*]?[ ]*(main|master|[0-9]+[.]([0-9]+|x)-stable)$' -e '^[*][ ]+' | xargs -r -n 1 git branch --delete
so:

    git pull --prune && git lint
sits very high in my history stats
jakub_g 2026-02-20 14:48 UTC link
The main issue with `git branch --merged` is that if the repo enforces squash merges, it obviously won't work, because SHA of squash-merged commit in main != SHA of the original branch HEAD.

What tools are the best to do the equivalent but for squash-merged branches detections?

Note: this problem is harder than it seems to do safely, because e.g. I can have a branch `foo` locally that was squash-merged on remote, but before it happened, I might have added a few more commits locally and forgot to push. So naively deleting `foo` locally may make me lose data.

Cherub0774 2026-02-20 15:05 UTC link
We all have something similar, it seems! I stole mine from https://stackoverflow.com/questions/7726949/remove-tracking-....

I also set mine up to run on `git checkout master` so that I don't really have to think about it too hard -- it just runs automagically. `gcm` has now become muscle memory for me.

  alias gcm=$'git checkout master || git checkout main && git pull && git remote prune origin && git branch -vv | grep \': gone]\'|  grep -v "\*" | awk \'{ print $1; }\' | xargs -r git branch -D'
d0liver 2026-02-20 15:09 UTC link
IIRC, you can do git branch -D $(git branch) and git will refuse to delete your current branch. Kind of the lazy way. I never work off of master/main, and usually when I need to look at them I checkout the remote branches instead.
EricRiese 2026-02-20 15:44 UTC link
Much more complicated than necessary. I just use

git branch | xargs git branch -d

Don't quote me, that's off the top of my head.

It won't delete unmerged branches by default. The line with the marker for the current branch throws an error but it does no harm. And I just run it with `develop` checked out. If I delete develop by accident I can recreate it from origin/develop.

Sometimes I intentionally delete develop if my develop branch is far behind the feature branch I'm on. If I don't and I have to switch to a really old develop and pull before merging in my feature branch, it creates unnecessary churn on my files and makes my IDE waste time trying to build the obsolete stuff. And depending how obsolete it is and what files have changed, it can be disruptive to the IDE.

WickyNilliams 2026-02-20 15:47 UTC link
I have a cleanup command that integrates with fzf. It pre selects every merged branch, so I can just hit return to delete them all. But it gives me the opportunity to deselect to preserve any branches if I want. It also prunes any remote branches

    # remove merged branches (local and remote)
    cleanup = "!git branch -vv | grep ': gone]' | awk '{print $1}' | fzf --multi --sync --bind start:select-all | xargs git branch -D; git remote prune origin;"
https://github.com/WickyNilliams/dotfiles/blob/c4154dd9b6980...

I've got a few aliases that integrate with fzf like an interactive cherry pick (choose branch, choose 1 or more commits), or a branch selector with a preview panel showing commits to the side. Super useful

The article also mentions that master has changed to main mostly, but some places use develop and other names as their primary branch. For that reason I always use a git config variable to reference such branches. In my global git config it's main. Then I override where necessary in any repo's local config eg here's an update command that updates primary and rebases the current branch on top:

    # switch to primary branch, pull, switch back, rebase
    update = !"git switch ${1:-$(git config user.primaryBranch)}; git pull; git switch -; git rebase -;"
https://github.com/WickyNilliams/dotfiles/blob/c4154dd9b6980...
nikeee 2026-02-20 15:48 UTC link
I use git-trim for that:

https://github.com/foriequal0/git-trim

Readme also explains why it's better than a bash-oneliner in some cases.

maerF0x0 2026-02-20 16:02 UTC link

    DEFAULT_BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p')

    git branch --merged "origin/$DEFAULT_BRANCH" \
      | grep -vE "^\s*(\*|$DEFAULT_BRANCH)" \
      | xargs -r -n 1 git branch -d
This is the version I'd want in my $EMPLOYER's codebase that has a mix of default branches
gritzko 2026-02-20 16:14 UTC link
If something this natural requires several lines of bash, something is just not right. Maybe branches should go sorted by default, either chronologically or topologically? git's LoC budget is 20x LevelDBs or 30% of PostgreSQL or 3 SQLites. It must be able to do these things out of the box, isn't it?

https://replicated.wiki/blog/partII.html

fphilipe 2026-02-20 16:37 UTC link
Here's my take on the one-liner that I use via a `git tidy` alias[1]. A few points:

* It ensures the default branch is not deleted (main, master)

* It does not touch the current branch

* It does not touch the branch in a different worktree[2]

* It also works with non-merge repos by deleting the local branches that are gone on the remote

    git branch --merged "$(git config init.defaultBranch)" \
    | grep -Fv "$(git config init.defaultBranch)" \
    | grep -vF '*' \
    | grep -vF '+' \
    | xargs git branch -d \
    && git fetch \
    && git remote prune origin \
    && git branch -v \
    | grep -F '[gone]' \
    | grep -vF '*' \
    | grep -vF '+' \
    | awk '{print $1}' \
    | xargs git branch -D

[1]: https://github.com/fphilipe/dotfiles/blob/ba9187d7c895e44c35...

[2]: https://git-scm.com/docs/git-worktree

jldugger 2026-02-20 16:53 UTC link
This looks loosely like something already present in git-extras[1].

    [1]: https://github.com/tj/git-extras/blob/main/Commands.md#git-delete-merged-branches
andrewaylett 2026-02-20 17:50 UTC link
I keep a command `git-remove-merged`, which uses `git ls-remote` to see if the branch is set up to track a remote branch, and if it is then whether the remote branch still exists. On the assumption that branches which have had remote tracking but no longer do are either merged or defunct.

https://gist.github.com/andrewaylett/27c6a33bd2fc8c99eada605...

But actually nowadays I use JJ and don't worry about named branches :).

chill_ai_guy 2026-02-21 00:00 UTC link
The Git command is whatever, pretty basic and stuff i have done forever but i am glad i clicked because ended up going down the rabbithole of the Wikileaks it was sourced from

Some unhinged stuff there. Like the CIA having a project called "Fine Dining" which was basically a catalog of apps that could be put on a USB drive to hide malicious code.

A case officer picks a cover app from a list of 24: VLC, Chrome, Notepad++, 2048, Breakout. Plug in the USB. Cover app opens. Exfiltration runs silently behind it. Target walks back in and the officer can just say "oh was just playing some games on this machine"

Score Breakdown
-0.05
Preamble Preamble
Low
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Preamble concepts not directly engaged; technical content is neutral to human rights; minor privacy tracking signals present

+0.05
Article 1 Freedom, Equality, Brotherhood
Low
Editorial
ND
Structural
+0.05
SETL
ND
Combined
ND
Context Modifier
ND

No direct engagement; open publication is mildly consistent with equal dignity principles

0.00
Article 2 Non-Discrimination
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

No discrimination signals observable; technically neutral content

0.00
Article 3 Life, Liberty, Security
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Right to life/security not engaged in technical tutorial

0.00
Article 4 No Slavery
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Slavery/servitude not engaged

0.00
Article 5 No Torture
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Torture/degrading treatment not engaged

0.00
Article 6 Legal Personhood
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Right to recognition before law not engaged

0.00
Article 7 Equality Before Law
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Equal protection before law not engaged

0.00
Article 8 Right to Remedy
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Remedy for violation not engaged

0.00
Article 9 No Arbitrary Detention
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Arbitrary arrest/detention not engaged

0.00
Article 10 Fair Hearing
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Fair trial rights not engaged

0.00
Article 11 Presumption of Innocence
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Criminal law principles not engaged

-0.47
Article 12 Privacy
Medium Practice
Editorial
-0.20
Structural
-0.25
SETL
+0.11
Combined
ND
Context Modifier
ND

Content discusses privacy-adjacent technical topics; site structure includes Google Analytics tracking without explicit privacy notice or consent mechanism observable. Editorial reference to leaked CIA documents is journalistic but structural tracking signals negative lean on Article 12 (privacy/correspondence)

0.00
Article 13 Freedom of Movement
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Freedom of movement not engaged

0.00
Article 14 Asylum
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Asylum/persecution not engaged

0.00
Article 15 Nationality
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Nationality not engaged

0.00
Article 16 Marriage & Family
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Marriage/family rights not engaged

0.00
Article 17 Property
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Property rights not engaged

0.00
Article 18 Freedom of Thought
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Freedom of thought/conscience/religion not engaged

+0.37
Article 19 Freedom of Expression
Medium Advocacy Framing
Editorial
+0.35
Structural
+0.15
SETL
+0.26
Combined
ND
Context Modifier
ND

Editorial positive: Author freely expresses technical knowledge and references leaked documents (WikiLeaks Vault7). Structural positive: Content freely accessible without registration/paywall, supporting information freedom. Framing neutral/positive regarding information access

+0.05
Article 20 Assembly & Association
Low
Editorial
ND
Structural
+0.05
SETL
ND
Combined
ND
Context Modifier
ND

No restrictions on assembly observable; open forum access present

0.00
Article 21 Political Participation
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Political participation not engaged

0.00
Article 22 Social Security
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Social security/welfare not engaged

0.00
Article 23 Work & Equal Pay
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Work/employment rights not engaged

0.00
Article 24 Rest & Leisure
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Rest/leisure not engaged

0.00
Article 25 Standard of Living
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Adequate standard of living not engaged

+0.13
Article 26 Education
Medium Advocacy
Editorial
+0.15
Structural
+0.10
SETL
+0.09
Combined
ND
Context Modifier
ND

Editorial positive: Author shares technical knowledge openly and educationally. Content facilitates learning/skill development in software development. Structural positive: Free access to technical education materials supports educational access

+0.23
Article 27 Cultural Participation
Medium Advocacy Framing
Editorial
+0.20
Structural
+0.15
SETL
+0.10
Combined
ND
Context Modifier
ND

Editorial positive: Author participates in cultural/intellectual production (technical writing). Structural positive: Free sharing of intellectual work; attribution clear (author identified). Framing supports participation in cultural/technical commons

0.00
Article 28 Social & International Order
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Social/international order not engaged

0.00
Article 29 Duties to Community
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Duties to community not engaged

0.00
Article 30 No Destruction of Rights
Editorial
ND
Structural
0.00
SETL
ND
Combined
ND
Context Modifier
ND

Prevention of UDHR destruction not engaged

About HRCB | By Right | HN Guidelines | HN FAQ | Source | UDHR
build fc56cf0+0q5s · 2026-02-25 01:32 UTC