Live data from Hacker News

Git Notes: Git's coolest, most unloved­ feature (2022)

tylercipriani.com

81–90 of 147 posts

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#82
post #58

There are many "Git's coolest, most unloved feature", e.g.: bisect, pickaxe, reflog, range-diff, archive, annotated tags, etc. Sadly they are often forgotten as many people thing of Git only as a glorified Google Drive...

In many cases this is because those features arent actually that useful and they are frivolities surrounding a workhorse.

I use a lot of features of my tools only when the shit hits the fan. People appreciate me doing it quickly. What they don’t appreciate is when I get mad at them for polluting those tools during their normal activities. Like destroying git history by renaming files incorrectly.

It’s hard to explain to them that things like “mis en place” aren’t OCD but table stakes for sophisticated activities.

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#83
post #74
post #36

Earlier quoted context omitted.

The history-destroying problems of rebasing are a rant on their own.

Can you say more? I use rebase to avoid history destruction/obscuration. Do you mean squash? If so then I agree.

Eh, squash has its place, too. Sometimes I made a simple typo, so I make another commit that fixes the typo and I squash the last two commits.

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#84

Earlier quoted context omitted.

Yeah I wish GitHub supported these

As described in the post they did in the past: https://github.blog/news-insights/git-notes-display/

It does not say why they got rid of it.

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#86
post #58

There are many "Git's coolest, most unloved feature", e.g.: bisect, pickaxe, reflog, range-diff, archive, annotated tags, etc. Sadly they are often forgotten as many people thing of Git only as a glorified Google Drive...

In many cases this is because those features arent actually that useful and they are frivolities surrounding a workhorse.

When I presented most of the ones that I listed to other people they started to say how it would be great if they know these features before, and started to use immediately.

So, yet I understand that some tools do too much, I don't think that this is the case here.

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#87

There are many "Git's coolest, most unloved feature", e.g.: bisect, pickaxe, reflog, range-diff, archive, annotated tags, etc. Sadly they are often forgotten as many people thing of Git only as a glorified Google Drive...

Ha, I expected to know the features you were going to list, but got surprise attacked by pickaxe. What the hell? I guess I shouldn’t be so confident

Once I started to use it I almost never used blame anymore

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#88
Sounds really cool, but how do notes play together with the "history rewriting" features (amend, rebase, etc) where you effectively replace a commit with a modified copy? It sounds as if the notes are attached to a specific commit (or tree or blob) ID. Are git rebase etc smart enough to also copy over the notes to the new commit, or will they just vanish?

What happens on interactive rebases, e.g. if I squash multiple commits into a single one?

I see the same problem with attaching notes to blobs and trees: It's not doing what you might think it does: It feels like it would attach metadata to a file or directory in the repo, but it really attaches the metadata to some specific content:

E.g. if you have a blob that encodes the string "Hello world!" and attach the note to it, would git associate that note with all files that have that content?

Also, if you change one file to "Hello, world!", would it lose the notes?

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#89
post #10

What happens of you rebase a branch containing commits with notes attached?

Notes are copied to from the original to the rewritten commit by default. See https://git-scm.com/docs/git-notes#Documentation/git-notes.t... for details. But I have this in my IRC logs: TIL git-notes rewriting doesn't work properly when doing amend within rebase. :/

Yeah I think that's a pretty big issue. Not going to be fun using git notes for code review if they get lost every time you squash or recreate commits.

One thing that would be really useful though - if you could somehow use git notes to tell Git not to download some blobs by default that would be great. It would solve the "someone added 100 MB of binary files to this project 5 years ago and then deleted them" problem.

That would be too useful though so I wont hold by breath.

Re: Git Notes: Git's coolest, most unloved­ feature (2022)

#90
post #88

Sounds really cool, but how do notes play together with the "history rewriting" features (amend, rebase, etc) where you effectively replace a commit with a modified copy? It sounds as if the notes are attached to a specific commit (or tree or blob) ID. Are git rebase etc smart enough to also copy over the notes to the new commit, or will they just vanish? What happens on interactive rebases, e.g. if I squash multiple…

> Are git rebase etc smart enough to also copy over the notes to the new commit...

This is configurable. By default, amend and rebase operations will copy them forward. See git-config(1) under `notes.rewrite`.

Post reply on HN