Highlights from Git 2.35
github.blog
github.blog
Magit is genuinely amazing.
Thanks @tarsius!
Will this change make your work on Magit easier?
If there was something you could add/remove to/from Git to make your life easier, what would it be?
Also I have to continue supporting older Git releases anyway; people like to use the latest Magit version without considering doing the same for Git, for some reason.
Change the license to GPLv2 OR later.
Something like how the current `add -p` allows you to select or reject any given chunk.
It's even right in the article. (Then goes on to describe how this change means you can stash those chunks easily if you've already selectively staged them.)
1) Post the wrong answer.
2) Get corrected.
3) ProfitThrowing away the construction history of something just seems wrong in git-land. The git format already allows this - it's just the tooling and culture that needs to be adapted for it to happen.
Imagine someone sending in a patch for the Linux kernel, or for git itself, only it isn't only the patch but a bunch of temporary patches that in the end forms something usable. (But don't worry because a git feature will make the log skip over it!) Would you really want to review that? Would you really want it stored in the repository for all eternity?
Crafting commits that are easy to understand and gives enough context to understand the change is the only way a large software repository can survive without collapsing under its own historical weight.
Adding back the thought process that the commits can reveal can often be hard later, even for the original author.
Logical commits serve a real purpose: they make change review easier and can help bisect bugs later.
That's orders of magnitude more useful than someone else's development thought process, which may or may not even make sense to anybody else.
If thought process is important, it should be captured in a structured way like a thoughtful commit message or README addition. Not some cobbled together mess of whatever commits someone made haphazardly.
If not, here are some clarifications. (Maybe they'll help even if we are talking past each other.)
> Removing can't always be done later, because that requires rewriting the repository's history.
I knew this could come up which is why I included glossed over.
> Logical commits serve a real purpose: they make change review easier and can help bisect bugs later.
Nothing I wrote was meant to conflict with that. Quite on the contrary I specifically want more points to bisect against (yes, I'm one of those who actually uses bisect).
> If thought process is important, it should be captured in a structured way like a thoughtful commit message or README addition. Not some cobbled together mess of whatever commits someone made haphazardly.
Have you tried getting anything reasonable about the thought process behind a feature into a README, and then tried to get it to stick there?
On the other hand a bunchbof commits along the lines of:
- rough first sketch
- introduce tests.
Also includes modifications to xyz to simplify testing.
- performance optimizations
- more tests
- Introduce test for foo and fix it in bar and baz
This has a negative impact on performance but is hard to avoid.
etc
I'm honestly asking in good faith, as the commits you gave as an example are literal anathema to me, and I'd like to understand what value anyone can see in them.
Problem is if we let squash zealots have their way they are gone together with the rest.
Storage is cheap.
You'll never ever be bothered by those commits unless you are bisecting and at that point you are probably thankful of you can find a commit message along the lines of:
- performance optimizations
- workaround for weird problem foo problem in prod
as they will tell you a lot about how to approach it.
Edit:
Just having tests and modification because of tests added in their own commit and with a comment ("Also includes modifications to xyz to simplify testing." above) is useful.
I do look into commits on a weekly basis or more to figure out why stuff was moved / replaced.
Just yesterday I stopped a PR because a constant was changed in an unrelated commit as part of the larger PR.
Because commits are granular it was really easy to see that it wasn't intended.
Wouldn’t that make bisecting more difficult?
If your history is full of checkpoint commits, wouldn’t bisect send you to broken commits (that you’d have to `--skip`) more often?
Why would you want to deal with those extra steps?
I guess on AAA game engines where compiles take half an hour it is more of a problem but in my case it takes 30 - 120 seconds depending on project.
(I do have uncompilable WIP steps, and those I am kind of ashamed for but those are so few and so far between that it doesn't matter.)
I'm honestly rather confused on the whole idea of valuing the journey instead of the end result. Aren't commit messages literally the built-in way to write about your journey to your heart's content? And failing that, you probably (should) have a ticket system or the like to preserve even more context in the form of third party comments etc.
I usually compare git history to a book: it's not valuable for the end user to see all the tiny edits and errors the author made before the final version, and in the end the important thing is that it tells a good story that the end user can easily follow.
Like it's said, the source code is for us humans to read. The computers would do just as fine without the story its trying to tell.
What's missing is many git tools don't let you easily filter out non-merge commits.
A
|\
| B
|/
C
and git log --first-parent will show A and C, and hide B, even though B's code is contained in A. We used this all the time at Ksplice, where we had some custom tooling that made it easy create those triangles and our build system would use the commit message on A while ignoring B in order to build updates.For example, if we've inserted ABC and removed XYZ, we might want to put those in separate commits: insert ABC above XYZ, then remove XYZ. If the diff gets them the wrong way round (inserting ABC below XYZ), then we have to manually edit the patch.
This is unavoidable in general, but fiddling with the options can reduce its occurrence. In particular, the default algorithm often spots exact matches like lines only containing '{', then comes up with really convoluted diffs in order to keep those braces matched up (often this will delete entire functions and add them all back!).
And now they introduced `zdiff3` which looks even better, will be trying it once I update.
I hate this approach because this is very lazy (you avoid thinking about hard stuff and pick easy solution) and is very short term
sure you can introduce 150 configuration modes
but it makes your thing messy, confusing for new people, confusing for inexperienced and requires more maintenance
it's like taking tech debt
Loads of people who have to maintain things.
>by the time it actually gets removed in a future version.
doesn't always happen, so we're left with new, new v2, new v3 options and old one still exists "because it may break somebody's workflow"
I guess the difference is subtle, especially that there can be other merges within the same file that merge cleanly in both cases.
Yes, and to say that another way, it's literally impossible to resolve merge conflicts correctly with only the standard conflict style. See my post on StackOverflow for more details: https://stackoverflow.com/a/63739655/997606
It displays two diffs: one from the ancestral commit to “ours” and one from the ancestral commit to “theirs”. I find it helpful for understanding conflicts and how to resolve them — any feedback appreciated.
Is my understanding correct that you'll also need the git hosting providers (Github, Gitlab) to understand and interpret those kinds of signed commits in order to show the 'verified' badge?
[1]: https://github.com/github/feedback/discussions/7744#discussi...
A while ago I wrote a vim plugin for this, has a bug where it (only sometimes?) won't go to the last conflict, but it's been helpful enough that I use it frequently.
https://github.com/OJFord/vim-quickfix-conflicts
(Yes, shameless promotion/maybe bait someone more familiar with vimscript into using it and immediately spotting cause of the above!)
- The reason the Unix world chose to have "long" as 64 bits: https://unix.org/version2/whatsnew/lp64_wp.html
- The reason the Windows world chose to keep "long" as 32 bits: https://devblogs.microsoft.com/oldnewthing/20050131-00/?p=36...
https://git-scm.com/download/mac
I tried brew and it seems to have the old version; another download link gives me a 5-month-old version. Why is there no official click-to-install release?
brew edit git
That should open this in your editor:https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/...
Change the url and sha256, then
brew install git
(This is from memory; I'm not in front of a shell, but I think it's correct.) 11:15:43 ~ brew info git
git: stable 2.35.0 (bottled), HEAD
Distributed revision control system
https://git-scm.com
/usr/local/Cellar/git/2.34.1 (1,513 files, 42.7MB) *
Poured from bottle on 2021-11-30 at 14:52:55
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/git.rb
License: GPL-2.0-only
...
[1]: https://github.com/Homebrew/homebrew-core/blob/master/Formul...Some of the complexity is because of some bad UX decisions that were made early on. Those are difficult to undo.
I’d recommend an average coder to practice, be patient, and not give up. I don’t think there’s a way around it. They’ll eventually get the hang of it, form a decent mental model, and eventually master the subcommands and switches they find most useful.
Since diff is used to make patches it could ruin things I imagine..
Another use case is when you encounter that giga god-commit “added formater” which touched all lines in all files.
If you take this even further, you can tailor to anyones style taste, formatting on check out instead of check in. That leaves the stored code as a serialization format the compiler understands. Viewed code is in whatever format the programmer likes.
Throw this script into $PATH (let's say into ~/.local/bin/diff-fmt):
#!/bin/bash
exec delta <(gofmt "$1") <(gofmt "$2")
here I'm using delta as the difftool: https://github.com/dandavison/deltaand then, once:
$ git config --global interactive.diffFilter diff-fmtSadly, even Google is so confused about Git VS GitHub that searching for "git blog" shows github.blog as the first result...
Probably the most obvious reason is that author Taylor Blau is employed by Github. If Github funds his work on Git, it doesn't seem strange at all that he posts on his employer's website.
Also, if you're referring to "git-scm.com" as the "main website of Git", there may be practical reasons such as TB not having any authoring privileges there to write a blog type of post. I notice that Git contributor Junio C Hamano who wrote the Git release notes doesn't post blog articles there either. JCH's blog-style posts seem to be at a different url: https://git-blame.blogspot.com/
You didn't ask but a related question people wonder about is why HN users (such as ossusermivami in this thread's case) submit Github links more often than the Git mailing list release notes: https://news.ycombinator.com/item?id=28207811
I'd wager because it's more discoverable, more readable and contains very useful layman-readable explanations of what is going on in this release
The Git project itself posts release notes, but those are more abbreviated and aimed at a audience that's a bit more familiar with Git's workings: https://raw.githubusercontent.com/git/git/master/Documentati...
You seem a bit confused yourself. GitHub and Git are different entities. So this is like asking why the New York Times is commenting on the price of tea in China—why shouldn’t they comment on it?
If you want the news straight from the source (without nice HTML markup): https://marc.info/?l=git&m=164305383314846&w=2
Does https://git-scm.com/ even have a blog? I don't think Google is confused, it's just trying to give you the most relevant results.