Live data from Hacker News

My new Git utility `what-changed-twice` needs a new name

blog.plover.com

51–60 of 65 posts

Re: My new Git utility `what-changed-twice` needs a new name

#51
post #30
post #12

Earlier quoted context omitted.

I agree. I decided years ago that that was a lot of work for little or no benefit. It's enough for the tests to pass at each merge point.

…and that’s why squash merge should be the default setting in PRs.

You can `git bisect --first-parent` just fine without needing to squash.

Re: My new Git utility `what-changed-twice` needs a new name

#53

Earlier quoted context omitted.

git-autofixup is better and easier to install: https://github.com/torbiak/git-autofixup

Could you elaborate how it is better?

They are quite different methods, explained by the respective implementations. IME autofixup finds the relevant commit successfully more often. There's no reason you can't use both, of course. I would always check the results of either before actually doing the rebase.

Re: My new Git utility `what-changed-twice` needs a new name

#54
post #12

Earlier quoted context omitted.

This is why I no longer do atomic commits. I've just never had it be a benefit to walk through and guarantee that each commits tests and builds successfully. I so rarely back out changes that when I do, I test then that everything is working (and let's be honest, I back out usually at the PR level, not the commit).

I agree. I decided years ago that that was a lot of work for little or no benefit. It's enough for the tests to pass at each merge point.

I would say most workplaces have settled similarly.

Sit in draft until you're ready to use the CI - which you verified locally or run manually in draft, before convert to reviewable - then review, maybe tweak, merge.

Atomic commits would endanger me losing unfinished work or eventual dead-ends with no record. This seems inefficient.

Re: My new Git utility `what-changed-twice` needs a new name

#55
post #7

You know, I find myself partially agreeing that a number of utilities for git could be done quite nicely in perl.

Git's repository includes quite a bit of Perl, but they want to get rid of it.

Is there any reason for doing so?

Re: My new Git utility `what-changed-twice` needs a new name

#56
post #42
post #17

Earlier quoted context omitted.

At the time I started writing the article, the utility was called `analyze-commits`. Hard to think of a worse name than that! By the time I finished writing it I had come up with a less crappy name, but I thought I'd leave the question in the post anyway.

If you’re looking for something descriptive and not clever/catchy, I propose ‘find-repeat-changes’.

Or indeed "Find Repeat EDits" or fred for short.

Re: My new Git utility `what-changed-twice` needs a new name

#57
post #6

> There's bonus information too. If a commit is not mentioned in the report, then it only changed files that didn't change in any other commit. That means that in a rebase, I can move that commit literally anywhere else in the sequence without creating a conflict. Only the commits in the report can cause conflicts if they are reordered. This is only true in the textual level. Semantically, re-shuffling commits like t…

This is why I no longer do atomic commits. I've just never had it be a benefit to walk through and guarantee that each commits tests and builds successfully. I so rarely back out changes that when I do, I test then that everything is working (and let's be honest, I back out usually at the PR level, not the commit).

> I've just never had it be a benefit to walk through and guarantee that each commits tests and builds successfully.

If you never look at individual commits in your history, you might as well squash them.

Re: My new Git utility `what-changed-twice` needs a new name

#58

Earlier quoted context omitted.

This seems very similar to how I work by default. I sort of think in terms of "keyframes" and "frames", or "commits" and "fixes to commits." Whenever I sit down to code with a purpose, I'll make a branch for that purpose: git checkout -b wip/[desc] When I make changes that I think will be a "keyframe" commit, I use: git add . git commit -m "wip: desc of chunk" (like maybe "wip: readme") if I make refinements, I'll do…

I think you might be aware given the specific words you use but for the benefit of others: Git commit --fixup lets you attach new commits to previous hashes you specify and then can automatically (or semi-manually depending on settings) squash them in rebases.

You can combine this with the `:/` syntax [0] for matching the most recent commit with a given text in the commit message, e.g.

    $ commit frobinator/ -m "refactor the frobnicator"

    [ more work ]

    $ commit echaton/ -m "immanentize the eschaton"

    [ oops, missed a typo ]

    $ commit frobinator/ --fixup :/frobic
0: https://stackoverflow.com/a/52039150

Re: My new Git utility `what-changed-twice` needs a new name

#59

Earlier quoted context omitted.

This seems very similar to how I work by default. I sort of think in terms of "keyframes" and "frames", or "commits" and "fixes to commits." Whenever I sit down to code with a purpose, I'll make a branch for that purpose: git checkout -b wip/[desc] When I make changes that I think will be a "keyframe" commit, I use: git add . git commit -m "wip: desc of chunk" (like maybe "wip: readme") if I make refinements, I'll do…

I think you might be aware given the specific words you use but for the benefit of others: Git commit --fixup lets you attach new commits to previous hashes you specify and then can automatically (or semi-manually depending on settings) squash them in rebases.

Thanks, I am —- but I always found it easier to just give the new commit a name I know how to squash rather than type in a SHA.

The other post about being able to do it on a substring match sounds way more ergonomic though, I’ll have to try that!

Re: My new Git utility `what-changed-twice` needs a new name

#60
post #7

Earlier quoted context omitted.

Git's repository includes quite a bit of Perl, but they want to get rid of it.

Is there any reason for doing so?

It's a pain in the backside to run on Windows, for two reasons. Firstly, Windows doesn't have (by default) a lot of the tools that are preinstalled in most nix environments. Git for Windows ships half a Cygwin distribution (MSYS2) including Bash, Perl, and Tcl.

Second, Windows doesn't really have a 'fork' API. Creating a new process on Windows is a heavyweight operation compared to nix. As such, scripts that repeatedly invoke other commands are sluggish. Converting them to C and calling plumbing commands in-process has a radical effect on performance.

Git for Windows is more of a maintained fork than a real first-class platform.

Also, I believe it's a goal to make it possible to use Git as a library rather than as an executable. That's hard to do if half the logic is in a random scripting language. Library implementations exist - notably libgit2 - but it can never be fully up to date with the original. Search for 'git libification'.

Many IDEs started their Git integration with libgit2, but subsequently fell foul of things that libgit2 can't do or does inconsistently. Therefore they fall back on executing `git` with some fixed-format output.

Post reply on HN