Live data from Hacker News

The git history command

lalitm.com

221–230 of 330 posts

Re: The git history command

#221

Earlier quoted context omitted.

That sounds like it would break bisect

You can develop with failing tests and reorder them after the code change before publishing your branch.

Of course, but this thread was in the context of someone "carefully curating" their git history

Re: The git history command

#222

Earlier quoted context omitted.

> the value that Git provides -- branching (not just ephemeral branching for your local convenience). I think this is the disconnect. I could see big libraries maintaining branches for each major release and I understand why linux does it. But if I'm maintaining FooService at work then I actually do just want a linear graph of all the commits that have been in production, in commit order.

If you want that, mandate developers use prefixes like `!fixup` and do `git rebase` _on your end_ -- why force upon everyone your ideas especially if it also squashes all development history? This also removes development friction because people can work with Git on their end the way they like without regard to some convention that can be avoided -- save for the "!fixup" thing which can be considered useful metadata.

I do enforce rebased, releasable merges to master on my end, I'm not campaigning to remove branching from git for everyone.

Just saying, in the common case, the simple approach actually is pretty good.

Re: The git history command

#223
post #12

I like to be like an accountant. No editing history. Create a new "journal entry" (i.e. commit) to fix.

There is history that has already happened (e.g. what has been merged to master) and history that will happen (e.g. unmerged pull requests).

Re: The git history command

#224

Earlier quoted context omitted.

No the bad co worker is the one who is trying to offload his job on the reviewer.

A programmer's job is to deliver business value to their employer. If you're slowing down PR turnaround by mindlessly auto-rejecting on stuff that the suits don't care about, you better have a rock solid case for why that is going to deliver business value down the line, otherwise you're actively sabotaging your employer to bikeshed your personal preferences, which is the hallmark of a bad employee. Rejecting an obvi…

In most business settings, the ticket is the unit of value to the business. If a ticket is to big, the best way is to split it into several ticket. Then you create a PR for each. There can be some automation that update the status of the ticket alongside the PR. Splitting a PR futher into commits doesn’t make any sense, because the whole business operates with tickets.

When I do it, it’s for my convenience. I expect the reviewer to review the diff at the PR level, not at the commit level. And when it’s approved, I’ll squash and merge, because only the whole PR matters.

When the commit is the unit of work (email workflow) I curate locally.

Re: The git history command

#225
post #99
post #98

TIL, thx :-) somewhat related Q: how do you give two files the same ancestor? so git log will for each show the history to the beginnings of the originally unsplit file? useful for splitting large files.

That's not possible, because files don't have ancestors in git. Each commit's tree is tracked independently and copy/move is just something that's detected via heuristics.

But those heuristics could be better than they are now so that a git log will show the shared history for both copies.

Re: The git history command

#226

Earlier quoted context omitted.

That sounds like it would break bisect

> That sounds like it would break bisect Nonsense. First off, you can pick the starting commit, and nothing forces you to pick the test one. Second, bisect is designed to tracks changes from good state to bad state based on your personal criteria of what good and bad is. This means that you are free to put up tests that make sense to you (i.e., all tests except the one that was added as a red test) and even not run a…

Suppose we have a failing test. For many commits, gp carefully separated their change that would break our test, from the change that would fix the test. At some point, someone forgot to run the tests, and introduced a commit that broke the test without adding a second commit to fix it. Now it's treated as a "pre-existing failure," and many more commits are added on top.

How would you identify the commit that broke the test?

Re: The git history command

#227
post #30
post #20

Earlier quoted context omitted.

You probably shouldn’t be committing things that are broken…

With tools like GitHub Actions and some added constraints, it's not always possible. You literally need a commit to trigger the CI workflow and it starts to trash your branch. Besides, aren't we all familiar with git commit -m "typo"?

> With tools like GitHub Actions and some added constraints, it's not always possible. You literally need a commit to trigger the CI workflow and it starts to trash your branch

I'm with you on your overall point, but as a side note: this state of affairs is so tragic. It's been normalized for there to be test suites that nobody can run except the CI runner, and the only real way to run all the tests is to have GitHub do it. It's pure lock-in, and it's very sad that everything's moved this way.

CI actions should be a simple file of "action: command" lines, with at most a separate file that describes when given actions should run. All actions should be runnable locally just as easily as they are in CI. Or if the actions are so complicated they need a complex-ish environment, that environment should be the kind of thing you could run locally too with your hypervisor of choice, without having to think about it. But every VCS host that has an actions/pipelines product is financially incentivized to encourage you not to set things up this way, to preserve their lock-in.

Re: The git history command

#228

Earlier quoted context omitted.

No the bad co worker is the one who is trying to offload his job on the reviewer.

A programmer's job is to deliver business value to their employer. If you're slowing down PR turnaround by mindlessly auto-rejecting on stuff that the suits don't care about, you better have a rock solid case for why that is going to deliver business value down the line, otherwise you're actively sabotaging your employer to bikeshed your personal preferences, which is the hallmark of a bad employee. Rejecting an obvi…

You are assuming that the only thing the business in question cares about is moving fast without any consideration for long-term health. I'd consider that a bad place to work at.

Re: The git history command

#229
post #123

Earlier quoted context omitted.

Just squash everything before merging and call it a day That is also a line from top comment. Everyone read „perfectly curating git history” and went rage commenting instead of reading and understanding what OP wrote.

Nope. Perfectly curating history is indeed the opposite of squashing—you squash because you couldn't be bothered to curate your commits. Squashing is a workaround not an alternative solution.

You just contradicted your previous comment that was pointing out that fcraaldo is „spending effort in perfectly curating history” … or your comment was a joke with no indication it is a joke.

Re: The git history command

#230

> scary rebase -i commands that can leave your tree in a half-broken state if you so much as sneeze I'm glad to hear it, I thought that was just me. It gets especially hairy when moving commits around... Plus I have 3-way diffs enabled and I usually get confused by which section is which at least once a day. Also: does anyone know if `magit` has history support?

[deleted]
Post reply on HN