frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Ggml.ai joins Hugging Face to ensure the long-term progress of Local AI

https://github.com/ggml-org/llama.cpp/discussions/19759
262•lairv•2h ago•53 comments

I found a useful Git one liner buried in leaked CIA developer docs

https://spencer.wtf/2026/02/20/cleaning-up-merged-git-branches-a-one-liner-from-the-cias-leaked-d...
200•spencerldixon•2h ago•103 comments

Child's Play: Tech's new generation and the end of thinking

https://harpers.org/archive/2026/03/childs-play-sam-kriss-ai-startup-roy-lee/
48•ramimac•1h ago•28 comments

Trump's global tariffs struck down by US Supreme Court

https://www.bbc.com/news/live/c0l9r67drg7t
237•blackguardx•44m ago•145 comments

Show HN: A native macOS client for Hacker News, built with SwiftUI

https://github.com/IronsideXXVI/Hacker-News
80•IronsideXXVI•2h ago•43 comments

The path to ubiquitous AI (17k tokens/sec)

https://taalas.com/the-path-to-ubiquitous-ai/
430•sidnarsipur•5h ago•279 comments

Untapped Way to Learn a Codebase: Build a Visualizer

https://jimmyhmiller.com/learn-codebase-visualizer
116•andreabergia•7h ago•19 comments

PayPal discloses data breach that exposed user info for 6 months

https://www.bleepingcomputer.com/news/security/paypal-discloses-data-breach-exposing-users-person...
91•el_duderino•2h ago•15 comments

Web Components: The Framework-Free Renaissance

https://www.caimito.net/en/blog/2026/02/17/web-components-the-framework-free-renaissance.html
114•mpweiher•7h ago•70 comments

Minions – Stripe's Coding Agents Part 2

https://stripe.dev/blog/minions-stripes-one-shot-end-to-end-coding-agents-part-2
82•ludovicianul•4h ago•40 comments

Mothers (YC X26) Is Hiring

https://jobs.ashbyhq.com/9-mothers?utm_source=x8pZ4B3P3Q
1•ukd1•2h ago

The Rediscovery of 103 Hokusai Lost Sketches (2021)

https://japan-forward.com/eternal-hokusai-the-rediscovery-of-103-hokusai-lost-sketches/
27•debo_•4d ago•2 comments

Consistency diffusion language models: Up to 14x faster, no quality loss

https://www.together.ai/blog/consistency-diffusion-language-models
170•zagwdt•11h ago•63 comments

Raspberry Pi Pico 2 at 873.5MHz with 3.05V Core Abuse

https://learn.pimoroni.com/article/overclocking-the-pico-2
83•Lwrless•7h ago•19 comments

AI is not a coworker, it's an exoskeleton

https://www.kasava.dev/blog/ai-as-exoskeleton
390•benbeingbin•20h ago•401 comments

Infrastructure decisions I endorse or regret after 4 years at a startup (2024)

https://cep.dev/posts/every-infrastructure-decision-i-endorse-or-regret-after-4-years-running-inf...
378•Meetvelde•3d ago•165 comments

The Popper Principle

https://theamericanscholar.org/the-popper-principle/
9•lermontov•1d ago•1 comments

Reading the undocumented MEMS accelerometer on Apple Silicon MacBooks via iokit

https://github.com/olvvier/apple-silicon-accelerometer
105•todsacerdoti•11h ago•52 comments

Notes on Clarifying Man Pages

https://jvns.ca/blog/2026/02/18/man-pages/
37•surprisetalk•1d ago•21 comments

Show HN: Micasa – track your house from the terminal

https://micasa.dev
600•cpcloud•1d ago•191 comments

FreeCAD

https://www.freecad.org/index.php
304•doener•3d ago•119 comments

US plans online portal to bypass content bans in Europe and elsewhere

https://www.reuters.com/world/us-plans-online-portal-bypass-content-bans-europe-elsewhere-2026-02...
399•c420•1d ago•769 comments

Nvidia and OpenAI abandon unfinished $100B deal in favour of $30B investment

https://www.ft.com/content/dea24046-0a73-40b2-8246-5ac7b7a54323
216•zerosizedweasle•4h ago•184 comments

I tried building my startup entirely on European infrastructure

https://www.coinerella.com/made-in-eu-it-was-harder-than-i-thought/
558•willy__•7h ago•299 comments

Silicon Valley engineers were indicted for allegedly sending secrets to Iran

https://www.cnbc.com/2026/02/20/three-engineers-charged-stealing-google-trade-secrets-data-iran-s...
78•giuliomagnifico•5h ago•44 comments

A beginner's guide to split keyboards

https://www.justinmklam.com/posts/2026/02/beginners-guide-split-keyboards/
195•thehaikuza•4d ago•210 comments

Defer available in gcc and clang

https://gustedt.wordpress.com/2026/02/15/defer-available-in-gcc-and-clang/
235•r4um•4d ago•204 comments

Fast KV Compaction via Attention Matching

https://arxiv.org/abs/2602.16284
56•cbracketdash•11h ago•11 comments

Gemini 3.1 Pro

https://blog.google/innovation-and-ai/models-and-research/gemini-models/gemini-3-1-pro/
882•MallocVoidstar•1d ago•863 comments

An ARM Homelab Server, or a Minisforum MS-R1 Review

https://sour.coffee/2026/02/20/an-arm-homelab-server-or-a-minisforum-ms-r1-review/
103•neelc•14h ago•84 comments
Open in hackernews

I found a useful Git one liner buried in leaked CIA developer docs

https://spencer.wtf/2026/02/20/cleaning-up-merged-git-branches-a-one-liner-from-the-cias-leaked-dev-docs.html
197•spencerldixon•2h ago

Comments

whazor•1h ago
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.
lionkor•1h ago
That sounds like a complete waste of time and tokens to me, what is the benefit? So each time you do something, you let Claude one shot a tui? This seems like a waste of compute and your time
MarsIronPI•1h ago
On the contrary. Once these tools exist they exist forever, independently of Claude or a Claude Code subscription. IMO this is the best way to use AI for personal use.
duneisagoodbook•1h ago
yeah! they should focus on more productive pursuits, like telling people online what to do with their time and resources.
morissette•1h ago
And these are things outside of our control.
htnthrow11220•1h ago
They said each time they want something to be easier, not each time they do something. And they didn’t mention it has to be one-shot. You might have read too quickly and you’ve responded to something that didn’t actually exist.
bmacho•1h ago
Now that I think about it, if Claude can put most useful functions in a TUI and make them discoverable (show them in a list), than this could be better than asking for one-liners (and forgetting them) every single time.

Maybe I'll try using small TUI too.

Trufa•1h ago
The amount of little tools I'm creating for myself is incredible, 4.6 seems like it can properly one/two shot it now without my attention.

Did you open source that one? I was thinking of this exact same thing but wanted to think a little about how to share deps, i.e. if I do quick worktree to try a branch I don't wanna npm i that takes forever.

Also, if you share it with me, there's obviously no expectations, even it's a half backed vibecoded mess.

elliotbnvl•1h ago
The deps question is huge, let me know if you solve it.
SauntSolaire•38m ago
What's the point of open sourcing something you one shot with an LLM? At that point just open source the prompt you used to generate it.
freedomben•15m ago
Testing. If you share something you've tested and know works, that's way better than sharing a prompt which will generate untested code which then has to be tested. On top of that it seems wasteful to burn inference compute (and $) repeating the same thing when the previous output would be superior anyway.

That said, I do think it would be awesome if including prompts/history in the repos somehow became a thing. Not only would it help people learn and improve, but it would allow tweaking.

NetOpWibby•11m ago
To save time and energy?
unshavedyak•34m ago
I’ve been wanting similar but have instead been focused on GUI. My #1 issue with TUI is that I’ve never liked code jumps very smooth high fps fast scrolling. Between that and terminal lacking variable font sizes, I’d vastly prefer TUIs, but I just struggle to get over those two issues.

I’ve been entirely terminal based for 20 years now and those issues have just worn me down. Yet I still love terminal for its simplicity. Rock and a hard place I guess.

firesteelrain•1h ago
Can you explain TUI? I have never heard this before
ses1984•1h ago
Terminal UI.
Bjartr•1h ago
Terminal User Interface, contrasting with a Graphical User Interface (GUI). Most often applied to programs that use the terminal as a pseudo-graphical canvas that they draw on with characters to provide an interactive page that can be navigated around with the keyboard.

Really, they're just a GUI drawn with Unicode instead of drawing primitives.

Like many restrictions, limiting oneself to just a fixed grid of colored Unicode characters for drawing lends itself to more creative solutions to problems. Some people prefer such UIs, some people don't.

Muvasa•1h ago
I prefer tui's for two reasons. 1. Very used to vi keybindings 2. I like low resources software. I love the ability to open the software in less than a second in a second do what I needed using vi motions. And close it less than a second.

Some people will be like you save two seconds trying to do something simple. You lose more time building the tool than you will use it in your life.

It's not about saving time. It's about eliminating the mental toll from having to context switch(i know it sounds ai, reading so much ai text has gotten to me)

irl_zebra•40m ago
"It's not about saving time, it's about eliminating the mental toll from having to context switch"

This broke my brain! Woah!

criddell•50m ago
> an interactive page that can be navigated around with the keyboard

Or mouse / trackpad.

I really haven't seen anything better for making TUIs than Borland's Turbo Vision framework from 35ish years ago.

GCUMstlyHarmls•1h ago
Eg: lazygit https://github.com/jesseduffield/lazygit?tab=readme-ov-file#... https://github.com/sxyazi/yazi https://github.com/darrenburns/posting or I guess Vim would be a prominent example.

Peoples definitions will be on a gradient, but its somewhere between CLI (type into a terminal to use) and GUI (use your mouse in a windowing system), TUI runs in your terminal like a CLI but probably supports "graphical widgets" like buttons, bars, hotkeys, panes, etc.

giglamesh•1h ago
So the acronym is for Terrible User Interface? ;)
allarm•1h ago
No it's not.
KPGv2•1h ago
it's the name gen Z and gen alpha puppyn00bs have given to what us old heads have always called CLIs

on tik too young folks are always discovering "revolutionary" things and giving them names, ignoring they're either super mundane, or already have a name

on one hand, i absolutely LOVE the passion for discovery and invention

on the other hand, if you're 19yo you probably didn't discover something revolutionary

(Edit: I've seen some people online suggest a CLI is only when you manually type the command yourself, while a TUI incorporates text-based graphical elements, but that's something invented by young people; everything before GUIs was called a CLI until pretty recently. A terminal is /literally/ a command-line interface.)

TarqDirtyToMe•1h ago
They aren’t the same thing. TUI refers to interactive ncurses-like interfaces. Vim has a TUI, ls does not

I’m fairly certain this terminology has been around since at least the early aughts.

philiplu•59m ago
Sorry, but this 65 yo grey-beard disagrees. A TUI to me, back in the 80s/90s, was something that ran in the terminal and was almost always ncurses-based. This was back when I was still using ADM-3A serial terminals, none of that new-fangled PCs stuff.
KPGv2•41m ago
We might've been caught on different parts of the wave. I checked Ngrams out of curiosity

https://books.google.com/ngrams/graph?content=TUI&year_start...

Basically it was never used, then it was heavily used, and then never used, and then in the early 00s it took off again.

That'd explain why you used it, I never did, and now young kids are.

marssaxman•16m ago
Thanks for looking that up! It makes sense, of course - the line starts to drop in 1984, with the release of the Macintosh, and hits a trough around the launch of Windows 95.

It's not a term I recall hearing at all when I started using computers in the mid-'80s - all that mattered back then was "shiny new GUI, or the clunky old thing?" I really thought it was a retroneologism when I first heard it, maybe twenty years ago.

bombcar•38m ago
Exactly. A CLI is a single line - like edlin. A TUI takes over all or most of the screen, like edit or vi or emacs.

Norton Commander (or Midnight Commander) is probably the quintessential example of a powerful TUI; it can do things that would be quite hard to replicate as easily in a CLI.

cristoperb•52m ago
I don't know when the term became widespread for gui-style terminal programs, but the wikipedia entry has existed for more than 20 years so I think it is an older term than you imply.

https://en.wikipedia.org/w/index.php?title=Text-based_user_i...

booleandilemma•1h ago
It's definitely an acronym that got popular in the last year or so, though I'm sure there are people out there who will pretend otherwise. I've been in the industry 15+ years now and never heard it before. Previously it was just UI, GUI, or CLI.
freedomben•20m ago
It's gotten more popular for sure, but it's definitely been around a long time. Even just on HN there have been conversation about gdb tui ever since I've been here (starting browsing HN around 2011). For anyone who works in embedded systems it's a very common term and has been since I got into it in 2008-ish. I would guess it was much more of a linux/unix user thing until recently though, so people on windows and mac probably rarely if ever intersected with the term, so that's definitely a change. Just my observations.
hattmall•1h ago
What are some examples of useful TUI you made? I'm generally opposed to the concept
rw_panic0_0•1h ago
how do you trust the code claude wrote? don't you get anxiety "what if there's an error in tui code and it would mess up my git repo"?
sclangdon•1h ago
Isn't it this case no matter who wrote the code? How do you ever run anything if you're worried about bugs?
phailhaus•59m ago
When I write the code myself, I'm not worried that I snuck a `git reset --hard` somewhere.
embedding-shape•33m ago
> how do you trust the code claude wrote?

If that's something you're worried about, review the code before running it.

> don't you get anxiety "what if there's an error in tui code and it would mess up my git repo"?

I think you might want to not run untrusted programs in an environment like that, alternatively find a way of start being able to trust the program. Either approaches work, and works best depending on what you're trying to do.

freedomben•26m ago
I'm not GP, but I have backups, plus I always make sure I've committed and pushed all code I care about to the remote. I do this even when running a prompt in an agent. That goes for running most things actually, not just CC. If claude code runs a git push -f then that could really hurt, but I have enough confidence from working with the agents that they aren't going to do that that it's worth it to me to take the risk in exchange for the convenience of using the agent.
ithkuil•6m ago
I assume that whatever I type can be also flawed and take precautions like backups etc
eulers_secret•1h ago
Tig is a nice and long-maintained git tui you might enjoy, then!

If nothing else maybe for inspiration

kqr•25m ago
In the case of Git, I can warmly recommend Magit as a TUI. Not only does it make frequent operations easier and rare operations doable -- it also teaches you Git!

I have a draft here about one aspect of Magit I enjoy: https://entropicthoughts.com/rebasing-in-magit

galbar•1h ago
The git plugin in oh-my-zsh has an alias for this: gbda

It also has one for squash-merged branches: gbds

Very useful I've been using them for years

blakesterz•1h ago
That's handy! I just started using oh-my-zsh and I feel like I know about 4% of useful things it can do so far.
gjvc•1h ago
"trapd00r" is the theme you want, if only because the name is cool
giglamesh•1h ago
I change themes just often enough to completely forget how to do it and also forget whatever other adjustments I had to make to it all work. And like... is my config versioned somehow? This is a long way to say, Thank You for inspiring me to look at all that stuff again!
parliament32•1h ago
So effectively "I just discovered xargs"? Not to disparage OP but there isn't anything particularly novel here.
jimmydoe•1h ago
And they have to learn that from cia?

That says so much about the generation we are in, just don’t go to school but learn math from mafia

vntok•42m ago
Where else would you learn about triple-entry bookkeeping?
skydhash•1h ago
People really do need to read the “Unix Power Tools” book and realize their problem has been solved for decades.
gosub100•1h ago
"People just need to find the info they don't know about, so then they'll know it."
Someone1234•1h ago
This feels like gatekeeping someone sharing something cool they've recently learned.

I personally lean more towards the "let's share cool little productivity tips and tricks with one another" instead of the "in order to share this you have to meet [entirely arbitrary line of novelty/cleverness/originality]."

But each to their own I suppose. I wonder how you learned about using xargs? Maybe a blog-post or article not dissimilar to this one?

superxpro12•41m ago
No I agree with you. This whole aura of "well IIIII knew this and YOUUUUU didnt" needs to die. I get that it's sometimes redundant and frustrating to encounter the same question a few times... but there's always new people learning in this world, and they deserve a chance to learn too.

Why do people constantly have to be looking for any way to justify their sense of superiority over others? Collaborative attitudes are so much better for all involved.

parliament32•15m ago
I don't think there's anything wrong with sharing something cool, even if it's trivial to other people. The problem is framing a blog post with "ooh this was buried in the secret leaked CIA material".. and then the reader opens it to find out it's just xargs. It feels very clickbaity. Akin to "here's one simple trick to gain a treasure trove of information about all the secret processes running on your system!!" and it's just ps.
dewey•1h ago
If you are using Fork.app on Mac as your git client, this now exists (For one month now) there too: https://github.com/fork-dev/Tracker/issues/2200#issuecomment...
sigio•1h ago
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
1a527dd5•1h ago
I use

    #!/bin/sh
    
    git checkout main
    git fetch --prune
    git branch | grep -v main | xargs --no-run-if-empty git branch -D
    git pull
Save that next to your git binary, call it whatever you want. It's destructive on purpose.
arusahni•1h ago
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•1h ago
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...

oniony•1h ago
Have you tried Jujutsu? If you want to make a better VCS, your baseline should be that, in my opinion, because it already deals with a lot of the Git pain points whilst be able to read and publish to Git repositories.
gritzko•56m ago
The idea of using git as a blob storage and building entire new machinery on top is definitely a worthy one. At this point though, the de-facto baseline is no doubt git. If git as a store withstands the abuse of jj and jj becomes the industry standard, then I would agree with you. Also, at that point they may drop git backend entirely just because of price/performance discrepancy. git is overweight for what it does, if they make it do only the bottom 20%, then things will get funny.

Still, many oddities of git are inevitable due to its underlying storage model, so it makes sense to explore other models too.

jo-m•1h ago
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•1h ago
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•1h ago
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.

masklinn•44m ago
Not just squash merges, rebase-merges also don't work.

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

Hooking on remote branch deletion is what most people do, under the assumption that you tend to clean out the branches of your PRs after a while. But of course if you don't do that it doesn't work.

WorldMaker•23m ago
This is my PowerShell variant for squash merge repos:

    function Rename-GitBranches {
        git branch --list "my-branch-prefix/*" | Out-GridView -Title "Branches to Zoo?" -OutputMode Multiple | % { git branch -m $_.Trim() "zoo/$($_.Trim())" }
    }
`Out-GridView` gives a very simple dialog box to (multi) select branch names I want to mark finished.

I'm a branch hoarder in a squash merge repo and just prepend a `zoo/` prefix. `zoo/` generally sorts to the bottom of branch lists and I can collapse it as a folder in many UIs. I have found this useful in several ways:

1) It makes `git rebase --interactive` much easier when working with stacked branches by taking advantage of `--update-refs`. Merges do all that work for you by finding their common base/ancestor. Squash merging you have to remember which commits already merged to drop from your branch. With `--update-refs` if I find it trying to update a `zoo/` branch I know I can drop/delete every commit up to that update-ref line and also delete the update-ref.

2) I sometimes do want to find code in intermediate commits that never made it into the squashed version. Maybe I tried an experiment in a commit in a branch, then deleted that experiment in switching directions in a later commit. Squashing removes all evidence of that deleted experiment, but I can still find it if I remember the `zoo/` branch name.

All this extra work for things that merge commits gives you for free/simpler just makes me dislike squash merging repos more.

samhclark•20m ago
Depends on your workflow, I guess. I don't need to handle that case you noted and we delete the branch on remote after it's merged. So, it's good enough for me to delete my local branch if the upstream branch is gone. This is the alias I use for that, which I picked up from HN.

    # ~/.gitconfig
    [alias]
        gone = ! "git fetch -p && git for-each-ref --format '%(refname:short) %(upstream:track)' | awk '$2 == \"[gone]\" {print $1}' | xargs -r git branch -D"
Then you just `git gone` every once in a while, when you're between features.
Arch-TK•1h ago
Unfortunately doesn't work if the project you work on squashes everything :(
schiffern•1h ago
"ciaclean" is a nice touch.

I assume CIA stands for Clean It All.

sammyteee•1h ago
"Clean It All, Clean" :P
plufz•1h ago
I assume it means mess up commit history and install ”our” BDFL.
stabbles•1h ago
Missed opportunity to call it `git ciao`
trashymctrash•1h ago
If you squash your PR before merging, then this alternative worked really well for me:

  git fetch --prune && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
bmacho•1h ago
> But deleting them one by one is tedious. The CIA’s dev team has a cleaner solution:

  git branch --merged | grep -v "\*\|master" | xargs -n 1 git branch -d
Why don't we all use a shell with lists and objects? That one line above could look like this

  git.branches()
    .filter(b => b.merged && !b.current && b.name !== "master" && b.name !== "main")
    .forEach(b => git.deleteBranch(b.name))
taude•1h ago
I've had this in my ~/.bash_aliases for awhile:

  alias git-wipe-merged-branches='git branch --merged | grep -v \* | xargs git branch -D'
Trying to remember where I got that one, as I had commented the following version out:

  alias git-wipe-all-branches='git for-each-ref --format '%(refname:short)' refs/heads | grep -v master | xargs git branch -D'
Cherub0774•1h ago
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'
masklinn•47m ago
Same using a git alias rather than shell, and without the network bits, it just cleans up branches which have an upstream that has been deleted:

    '!f() { git branch --format '%(refname:short) %(upstream:track,nobracket)'  | awk '$2~/^gone$/{print $1}'  | xargs git branch -D; }; f'
d0liver•1h ago
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.
dietr1ch•1h ago
Wait, why would the update for the silly master->main change be swapping the excluded regex instead of just excluding both?
PunchyHamster•54m ago
coz OP has agenda and

> Since most projects now use main instead of master

some delusions to boot

Sesse__•1h ago
You probably want git-dmb (dmb = delete merged branches) for a safe and more comprehensive way of dealing with this.
puzz•58m ago
Or git-old-branches/git-recent from git-plus

https://github.com/tkrajina/git-plus

Disclaimer, I'm the author ^^

ihsoy•56m ago
Dont most git instances, like github, delete branch after a PR was merged, by default?

I am not sure under what usecases, you will end up with a lot of stale branches. And git fetch -pa should fix it locally

plqbfbv•51m ago
In Github it needs to be explicitly configured (Settings > General > Delete head branches after merging), Gitlab is the same.

A lot of my developer colleagues don't know how git works, so they have no idea that "I merged the PR" != "I deleted the feature branch". I once had to cleanup a couple repositories that had hundreds of branches spanning back 5+ years.

Nowadays I enforce it as the default project setting.

nightpool•51m ago
`--prune` will delete your local copies of the origin's branches (e.g. `origin/whatever`). But it won't delete your local branches (e.g. `whatever` itself). So PRs that you've worked on or checked out locally will never get deleted.
embedding-shape•29m ago
> Dont most git instances, like github, delete branch after a PR was merged, by default?

By default, I don't think so. And even if the branch is deleted, objects can still be there. I think GitLab has a "Clean stale objects" thing you can trigger, I don't seem to recall ever seeing any "Git Maintenance" UI actions on GitHub so not sure how it works there.

micw•52m ago
I recently let copilot create a document with a few helpful git commands and that particular one was the one it came with as solution for exactly this case.
password4321•49m ago
I don't delete branches, I just work with the top several most recently modified.
the_real_cher•45m ago
How to list those? Is there a flag for git branch to sort by recently modified?

(not on my computer right now to check)

embedding-shape•24m ago
I do `gb` (probably "git branch" when I set that up) which apparently is an alias to `git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)' | tac`, displays a list with the latest changed branch at the bottom. Remove the `| tac` for the reverse order.
rpozarickij•15m ago
This isn't exactly the same but I've been using git-recent [0] (with `gr` alias) for many years. It sorts branches based on checkout order (which is what I usually need when switching between branches) and allows to easily choose a branch to checkout to.

[0] https://github.com/paulirish/git-recent

jimnotgym•32m ago
I have an image of running his command, 'ciaclean', and a black van turnes up with a bunch of agents in coveralls, brandishing rolls of polyethylene sheeting and drums of acid.
EricRiese•28m ago
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.

cowlby•25m ago
Anyone else "vibe git-ing” lately? I just ask Claude Opus to clean it up and it does really well. Same for build commands and test harnesses.
mywittyname•5m ago
It does a pretty good job, but I still don't completely trust it with keys to the kingdom.

I have replaced my standard ddg of, "git <the thing i need>" with asking Claude to give me the commands I need to run.

WickyNilliams•25m ago
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...
devhouse•24m ago
don't forget to fetch first
nikeee•23m ago
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.

block_dagger•20m ago
I cleanup branches interactively with a few lines of bash, which takes a bit more time but is less likely to destroy active work.
WorldMaker•17m ago
I use this PowerShell variant:

    function Remove-GitBranches {
        git branch --merged | Out-GridView -Title "Branches to Remove?" -OutputMode Multiple | % { git branch -d $_.Trim() }
    }
`Out-GridView` gives you a quick popup dialog with all the branch names that supports easy multi-select. That way you get a quick preview of what you are cleaning up and can skip work in progress branch names that you haven't committed anything to yet.
markus_zhang•9m ago
Oh this is what ChatGPT told me when I asked "How to remove all local branch except main"...
maerF0x0•9m ago

    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