Live data from Hacker News

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

spencer.wtf

111–120 of 273 posts

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

#111
honestly my go to is kind of similar, but I prefer using --format vs. straight grep. just feels like the plumbing is cleaner out of the box:

    git branch --merged origin/main --format="%(refname:short)" \ | grep -vE "^(main|develop)$" \ | xargs -r git branch -d

that said... pretty hilarious a dev was just like "uhh yeah ciaclean..." curious what... other aliases they might have??

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

#114

Earlier quoted context omitted.

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"…

So the acronym is for Terrible User Interface? ;)

TUI is peak UI, anyone who disagrees just don't get it. Every program listens to the same keybindings, looks the same and are composable to work together. You don't get that clicking buttons with the mouse. It's built to get the work done not look pretty.

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

#115
post #18

Earlier quoted context omitted.

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…

The deps question is huge, let me know if you solve it.

If I'm understanding the problem correctly, this should be solved by pnpm [1]. It stores packages in a global cache, and hardlinks to the local node_packages. So running install in a new worktree should be instant.

[1]: https://pnpm.io/motivation

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

#116

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…

> For that reason I always use a git config variable to reference such branches. In my global git config it's main

    $(git config user.primaryBranch)
What about using git's own `init.defaultBranch`?

I mean, while useless in terms of `git init` because the repo's already init'd, this works:

    git config --local init.defaultBranch main
And if you have `init.defaultBranch` set up already globally for `git init` then it all just works

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

#117
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

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

#118

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…

You can pull another branch without switching first:

  git switch my-test-branch
  ...
  git pull origin main:main
  git rebase main

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

#119

> Since most projects now use main instead of master… I see that even the CIA, a federal government office, has not fully used DEI approved, inclusive language yet :-)

The leaked material from which this came was described as being from 2017, which makes that the latest this could have been written - GitHub only changed the default for new repos in October of 2020, and there had only been consensus building around the switch for a couple of years beforehand.
Post reply on HN