Live data from Hacker News

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

spencer.wtf

261–270 of 273 posts

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

#261

Earlier quoted context omitted.

Branches can be sorted. git config branch.sort ...

Amazing

I had configured that one ever since reading this very helpful article, which I suspect I discovered through HN a while ago:

https://blog.gitbutler.com/how-git-core-devs-configure-git

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

#262

Wait, why would the update for the silly master->main change be swapping the excluded regex instead of just excluding both?

coz OP has agenda and > Since most projects now use main instead of master some delusions to boot

What agenda, pray tell?

Since GitHub and GitLab both default to main, and Git doesn't default to anything, I'm pretty sure main being more prevalent than master is just a fact.

NB, the change from master to main isn't "silly", it's just an objectively more appropriate name. "Master" implies that the other branches are "slaves", i.e. that there is some hierarchy, which simply isn't the case. The term makes sense for IDE drives, but not Git branches. Master was an idiotic choice from day one.

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

#263

`git trash` https://github.com/henrikpersson/git-trash I use this script with a quick overview to prevent accidentally deleting something important

Incidentally, 'git trash' is also quite close to what I tend to shout in the office after running not quite the correct git command.

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

#264
post #30

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…

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.

> Not just squash merges, rebase-merges also don't work.

Are you sure? I almost exclusively rebase-merge, and I use ‘git branch --merged‘ all the time. It works perfectly fine for me.

Also conceptually it seems to make sense to me: you rebase your commits onto the tip of the target branch, so you can trivially follow the link from the tip of your source branch to the tip of your target branch, which as I understand it is what the command checks for.

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

#265
post #264

Earlier quoted context omitted.

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.

> Not just squash merges, rebase-merges also don't work. Are you sure? I almost exclusively rebase-merge, and I use ‘git branch --merged‘ all the time. It works perfectly fine for me. Also conceptually it seems to make sense to me: you rebase your commits onto the tip of the target branch, so you can trivially follow the link from the tip of your source branch to the tip of your target branch, which as I understand i…

Sounds like you update the source after rebasing? Because if you rebase then push on the target git sees no more relation between the two than if you squash.

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

#266

Earlier quoted context omitted.

Can you explain TUI? I have never heard this before

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.

It's been around as long as TUI tools have been around (Midnight Commander, etc)

Here's a blog post from 2014 [1] mentioning it.

Sometimes, we're the one in today's 10000, sometimes it's someone else [2]

[1] https://khanifnasrudin.blogspot.com/2014/11/text-based-user-... [2] https://xkcd.com/1053/

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

#267

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…

The use of init.defaultBranch here is really problematic, because different repositories may use a different name for their default, and this is a global (your home directory scope) setting you have to pre-set. I have an alias I use called git default which works like this: default = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' then it becomes ..."$(git default)"... This figures out th…

It's so funny. After seeing your comment I thought I must have this only to realize I already do: https://github.com/artuross/dotfiles/blob/main/home/dot_conf...

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

#268

Earlier quoted context omitted.

Isn't it this case no matter who wrote the code? How do you ever run anything if you're worried about bugs?

Different type of creator, different type of bugs. I'd assume a human giving me a way to delete merged branches has probably had the same issue, solved the same problem and understands unspecified context around the problem (e.g protect local data). They probably run it themselves so bugs are most likely to occur in edge cases around none standard use as it works for them. Ais are giving you what they get from common…

> ...a way any human would balk at (push main to origin, delete .git, re-clone from origin. Merged local branches are gone!)

Ahem... But yeah, then I -- or we, I and my team at the time -- (somewhat, at least rudimentarily) learned git.

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

#269
post #37

Earlier quoted context omitted.

[flagged]

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...

Yeah, but I see your link is to "Text-based_user_interface", not "Terminal_user_interface". (Personally, I recall seeing "Textual" at least as often as "Text-based".)

The styling "Terminal" is new to me; I'm not sure I've even ever seen it before this thread. That's the "new-fangled bit for gen-Z", as others in this sub-thread have bemoaned, AFAICS.

And I must admit I rather agree with those bemoaners: It's stupid. Sure, you do run your TUI apps in the terminal, but the terminal itself is really a CLI, not a TUI. This makes the term rather misleading.

So "Text[ual|-based] User Interface" is a far better reading of "TUI" than "Terminal User Interface", IM(ns)HO.

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

#270
post #78

Earlier quoted context omitted.

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.

I don't think that search is very valid - the TUI group travel companies are likely much more mentioned than Terminal User Interface. They are pretty big around the world and have an airline, cruises, hotels etc.

Yeah, but Preussag only changed its name to Touristik Union International in 1997[1], so I think the user interface interpretation clearly predates the travel agency one.

___

[1]: https://en.wikipedia.org/wiki/TUI_Group

Post reply on HN