Skip to content

Commit 0f012ac

Browse files
committed
rn-122: include answers from various community members
1 parent 5a56a91 commit 0f012ac

File tree

1 file changed

+336
-4
lines changed

1 file changed

+336
-4
lines changed

rev_news/drafts/edition-122.md

+336-4
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,343 @@ This edition covers what happened during the months of March and April 2025.
189189
## Community interview
190190

191191
_Editor note: For Git's 20th anniversary, we are doing an exclusive collaborative
192-
community interview and curating answers from various community members. Also,
193-
there's a short Q&A with our zealous, inclusive and tireless maintainer that
194-
follows below._
192+
community interview and curating answers of various community members. Also,
193+
there's a [short Q&A](#short-qa-with-our-maintainer-junio-c-hamano) with our
194+
zealous, inclusive and tireless maintainer that follows below._
195+
196+
197+
- **What's your favorite Git trick or workflow that you wish more people
198+
knew about?**
199+
200+
[_Thalia Rose_][thalia]: For rebase-heavy workflows, `git range-diff` is incredibly
201+
useful. To compare against upstream, use `git range-diff @{u}...@`,
202+
and to compare against the previous HEAD, use `git range-diff @{1}...@`.
203+
204+
[_Lucas Seiki Oshiro_][seiki]: Everything related to code archaeology
205+
(`git grep`, `git log -S/-G`, `git log -L` and `git bisect`). Those are
206+
my primary debugging tools and every time I explained them to other
207+
people they find them mind-blowing and useful.
208+
And they also started loving it :-)
209+
210+
[_Elijah Newren_][elijah]: [`range-diff`][range-diff]. The ideas behind
211+
it ought to be the basis for code review, IMO. Commits should be the
212+
unit of review (including commit messages as a fundamental and primary
213+
thing to be reviewed), and a series of commits should be the unit of
214+
merging. I dislike most code review tools, because they get one or
215+
both of those things wrong. Getting both of those things right naturally
216+
leads to `range-diff` or something like it being a very important part
217+
of the workflow, at a minimum for detecting which commits in a series
218+
are unmodified and which have been updated and need to be further reviewed.
219+
220+
221+
- **What was your worst Git disaster, and how did you recover from it?**
222+
223+
[_Thalia Rose_][thalia]: When I was first starting with Git, I wanted to make a repo
224+
to preserve my first coding project when I was twelve, a bunch of VBS scripts.
225+
I had assumed that Git maintained file modification timestamps, so I deleted
226+
the originals because they were now redundant. I now no longer know exactly
227+
when I wrote them and have been careful about timestamps ever since.
228+
229+
[_Luca Milanesio_][luca]: I suspect to be one of the worst offenders :-) [ [ref](https://www.infoq.com/news/2013/11/use-the-force) ]
230+
231+
Thankfully I was using Gerrit Code Review and the replication plugin:
232+
the refs were not lost but just rewind and we could reset all the
233+
correct SHA1s for all of them.
234+
235+
[_Lucas Seiki Oshiro_][seiki]: I don't remember something that I did,
236+
but I remember a simple and curious disaster: our deploy workflows
237+
stopped working, only leaving a message like "cannot fetch
238+
ambiguous reference `master`". I decided to investigate what happened
239+
and I found out that someone by mistake (I don't know how) created a
240+
tag called `master` and pushed it to GitHub. By the time we used the
241+
`master` branch for deploy, and the workflows didn't know if they
242+
should use the `master` branch or tag. GitHub didn't have a feature
243+
for deleting tags through the web interface, so we thought
244+
"what should we do?".
245+
246+
The solution was to run `git push origin :refs/tags/master`. Simple,
247+
but not obvious. A classic case where it only required a screw to be
248+
turned, but all the hard work was to find which screw should be turned.
249+
250+
[_Elijah Newren_][elijah]:
251+
My worst Git-related disaster wasn't with Git directly but with our
252+
Git hosting software we used at a prior job, Gerrit. 'twas a
253+
"startup" that was still forming good practices. We had both a
254+
production and a staging instance. The staging instance was seeded
255+
with a copy of production data so we could do scale testing...but that
256+
seeding process was a multi-step manual thing; it hadn't been
257+
automated. One step was, as best I recall, "drop database gerrit",
258+
followed by loading the production copy of the mysql database (this
259+
was long before [NoteDB][notedb] arrived). And as many readers
260+
probably have guessed by now, I was on the wrong host one day when
261+
I ran that command.
262+
263+
The actual git repositories were still intact, but the review metadata
264+
was toast. Luckily, we had a backup from about 7 hours earlier, so we
265+
could recover the older review metadata and with some hackery fix the
266+
mysql metadata mismatch with the newer repository contents. And since
267+
Gerrit emailed folks comments from reviews as they were posted, we
268+
could tell people to look at their emails for the pieces we couldn't
269+
recover.
270+
271+
It was a really long night trying to fix things. Some folks told me
272+
they thought I was going to throw up just looking at me. But I
273+
learned how wonderful it was to be at a company with blameless
274+
post-mortems, and I appreciated the many folks who reached out to tell
275+
me stories of mistakes they had made. They were more interested in
276+
whether we learned our lesson and put processes into place to prevent
277+
repeats, and I definitely did both.
278+
279+
I did, of course, also get some good-natured ribbing, such as people
280+
saying I got to play the part of little Bobby Tables once (see
281+
[this xkcd comic][bobby-tables] if you don't know that reference).
282+
I kindly reminded them that I didn't drop a table -- I dropped the whole
283+
database (plus, it wasn't injection, it was just running a command in
284+
the wrong location). Also, one of my colleagues helpfully modified
285+
the prompt on production to be red and bold, "This is PROD Gerrit",
286+
and the prompt on staging to be green, "This is staging Gerrit; it's
287+
okay to drop database here!" The prompts ended up not mattering since
288+
I automated the process, and made sure the process just error'ed out
289+
if run on prod instead of staging. But the prompt persisted for many
290+
years anyway, because I thought it was a hilarious way to poke fun at
291+
my blunder.
292+
293+
294+
- **If you could go back in time and change one design decision in Git,
295+
what would it be?**
296+
297+
[_Luca Milanesio_][luca]: Use SHA-256 straight away, as it was
298+
published 24 years ago and already existed at the time Git was designed.
299+
300+
[_Lucas Seiki Oshiro_][seiki]: Perhaps writing a more abstract CLI. After
301+
studying Git a little more deeper it makes sense for me, but I would group
302+
the functionality into more high-level subcommands and would make the flags
303+
and options more consistent across the subcommands.
304+
305+
For example, Docker CLI have all the image operations under
306+
`docker image` and all the network operations under `docker network`.
307+
If I want to delete an image, I use `docker image rm`, if I want to
308+
delete a network, I use `docker network rm`, and so on. I would make
309+
Git CLI work based on that idea, for example:
310+
311+
- `git branch add my_branch`
312+
- `git branch delete my_branch`
313+
- `git branch list`
314+
- `git remote add my_remote ...`
315+
- `git remote delete my_remote`
316+
- `git remote list`
317+
- `git tag add my_tag`
318+
- `git tag delete my_tag`
319+
- `git tag list`
320+
321+
With some shorter alias, just like Docker has `docker rmi` and
322+
`docker rm`.
323+
324+
[_Elijah Newren_][elijah]: The index. For a few reasons.
325+
326+
1. Performance.
327+
1. The index is pervasive throughout the codebase, and while it works
328+
great for small repositories, it means that many operations are O(size
329+
of repository) instead of O(size of changes). [sparse indices][sparse-index]
330+
help, but the code has to be carefully audited for sparse indices to
331+
work with each codepath, and even then there tends to be a fallback of
332+
just-load-everything-anyway because the data structure doesn't lend
333+
nicely to just expanding a little more.
334+
335+
2. An under-appreciated aspect of the performance improvements that
336+
came from our new merge strategy, [`merge-ort`][merge-ort], were due
337+
to dispensing with the index as the primary data structure. The index
338+
had two problems:
339+
1. first of all it meant loading every path in the repository,
340+
which would have prevented ort's optimization to avoid recursing into
341+
subtrees when unnecessary (an optimization that often made merges e.g.
342+
50x faster). Sparse indices didn't exist back then, but even if they
343+
had we would have had to complicate them significantly in order to
344+
have their sparseness be determined by renames and the intersection of
345+
modified paths on the two sides of history instead of having
346+
sparseness determined by user-defined path rules; I think that'd have
347+
been much more complicated than just dispensing with the index as the
348+
data structure, but we didn't even have sparse indices back then
349+
anyway.
350+
351+
2. Second, the use of the index as done in the old merge strategy,
352+
`merge-recursive`, resulted in O(N^2) behavior since entries (including
353+
conflicted higher order stages) had to be inserted in sorted order.
354+
Deleting entries didn't have the same O(N^2) problem due to some
355+
tricks to queue the deletion for later, but attempting to do the same
356+
for insertions was far from straightforward and I believe would have
357+
required making some other data structure primary and then forming the
358+
index at the end. (Note that the primary data structure used, whatever
359+
it is, cannot just have a list of things to insert, it also needs to
360+
be checked for various properties intermingled with insertions...and
361+
those sometimes relied on the fact that the index was sorted for quick
362+
lookups.) <br/><br />
363+
(Note that a tree-structured index rather than a linear index would
364+
resolve these problems. But retrofitting the entire codebase is
365+
probably never going to happen...)
366+
367+
2. Cognitive Complexity. <br/>The funny thing is, although I say this,
368+
I use the index all the time. I use `git add -p` a lot. I very much
369+
need to slice and dice my changes into different commits, and tend to
370+
have dirty changes that I don't want pushed. <br /> <br />
371+
But slicing and dicing before things are committed, as opposed to
372+
being able to slice and dice after, is a choice that adds a lot of
373+
complexity to the user interface and does so even for users who aren't
374+
interested in slicing and dicing commits. We don't have a
375+
sufficiently flexible set of tooling for slicing and dicing commits
376+
after-the-fact within git to switch to a post-commit-slice-and-dice
377+
workflow even today, but I suspect that some of the ideas from [JJ][jujutsu]
378+
would or could be much better than the methods I use today in git to
379+
slice and dice commits.
380+
381+
382+
- **Which Git feature or improvement over the past 20 years do you think
383+
had the biggest impact on your workflow?**
384+
385+
[_Lucas Seiki Oshiro_][seiki]: Sorry, but I can't answer. I am from a
386+
generation that started programming when Git was already the de facto
387+
VCS so I can't compare a world that has it with a world that doesn't have.
388+
389+
[_Elijah Newren_][elijah]: Speed.
390+
391+
Being able to instantly switch branches (in smaller repos, sure, but
392+
CVS and SVN couldn't pull it off even in small repos) was a game
393+
changer.
394+
395+
396+
- **What Git problem that existed 10 years ago has been most
397+
successfully solved?**
398+
399+
[_Lucas Seiki Oshiro_][seiki]: Sorry again, but 10 years ago I was only
400+
starting to use Git and when I started to use more complex features they
401+
already were there.
402+
403+
[_Elijah Newren_][elijah]: Merging and rebasing with lots of renames
404+
(and generally merging without a worktree or index). I'm obviously
405+
a bit biased on this point, but that doesn't mean I'm wrong. ;-)
406+
It used to be awful and works great now.
407+
408+
Relatedly, merging without a worktree or index was problematic; you
409+
had to either use an alternative merge strategy with limited
410+
capabilities, or use something other than git (e.g. [libgit2][libgit2]).
411+
But now git handles it well with its default merge strategy.
412+
413+
414+
- **Which Git commands or workflows do you think are still misunderstood
415+
or underutilized today?**
416+
417+
[_Lucas Seiki Oshiro_][seiki]: I think [squash merges][squash-merge] and
418+
[submodules][submodule] are really misunderstood, yet they are the opposite
419+
of being underutilized. Sadly I saw several people using them in daily basis,
420+
based on the wrong idea of what they are and then using them incorrectly.
421+
422+
423+
What I think it is underutilized is the full power of commits of being
424+
a good source of documentation and good resource for, again, performing
425+
code archaeology that may help understanding what the code does and
426+
debugging it. Several developers treat the commits as just checkpoints.
427+
428+
[_Elijah Newren_][elijah]: `range-diff` is very under-utilized, but I
429+
already discussed that above.
430+
431+
432+
- **What's one Git based project, tool, or extension you think deserves
433+
more recognition from the community?**
434+
435+
[_Lucas Seiki Oshiro_][seiki]: Perhaps it would be better to leave this
436+
question for other less known tools. But if you want an answer, I think:
437+
438+
- [Delta](https://github.com/dandavison/delta) is a really cool to
439+
format the diff-related outputs;
440+
441+
- [Kworkflow](https://kworkflow.org/) is a powerful tool for
442+
contributing to the Linux kernel source code (I should also
443+
try it for contributing to the Git source code);
444+
445+
- Merge drivers in general. `diff3` works in most cases but it is
446+
only based on pure diffs, without performing deeper operations based
447+
on the file format they are merging.
448+
449+
450+
- **What Git feature or capability surprised you most when you first
451+
discovered it?**
452+
453+
[_Lucas Seiki Oshiro_][seiki]: As you may have noticed, I'm really
454+
a fan of Git archaeology :-), so I would say all that I mentioned
455+
in the first answer (i.e., `git grep`, `git log -S/-G`, `git log -L`
456+
and `git bisect`). But my favorite is still [bisect][bisect].
457+
It's an egg of Columbus and everyone that I have shown it to
458+
was equally amazed by it!
459+
460+
461+
- **What's your boldest prediction about how version control might look
462+
in another 20 years?**
463+
464+
[_Lucas Seiki Oshiro_][seiki]: I still see Git as the dominant VCS
465+
in the future, but I think more Git-based VCSs (like [Jujutsu][jujutsu]
466+
will arise. Just like we have today programming languages built on top
467+
of the stack of the other languages (e.g. Clojure, Kotlin and Scala on
468+
JVM, TypeScript on JS), networking protocols written on top of other
469+
protocols (e.g. QUIC on UDP, gRPC on HTTP) and so on.
470+
471+
The Git core is simple, flexible, transparent and powerful and there's
472+
still room for people using it directly in several creative ways. Once
473+
I saw [a project using it as a backend for a NoSQL database][git-backend-nosql],
474+
who knows how many use cases we still have for it.
475+
476+
[_Elijah Newren_][elijah]: I'm more interested in what storms might be
477+
brewing along that path, and what we might be able to do to avoid them.
478+
In particular, some questions and observations in that area:
479+
480+
* With monorepos growing ever larger, do we have hard-to-workaround-or-fix
481+
design decisions that pose scaling challenges? e.g.
482+
* the index data structure
483+
* per-directory .gitignore files, per-directory .gitattribute files, etc.
484+
* ...or do the prominent Git forges have hard-to-workaround-or-fix
485+
design decisions that'll give Git a reputation for not scaling? e.g.
486+
* making refs/pull/NNN/merge a public ref and excessively
487+
implicitly updating it
488+
* Will we face a crisis of interest? e.g.
489+
* `git` is currently written in C. Even if that's not a liability
490+
already, coupled with "decades" I think it is. Young developers
491+
probably don't want to learn C, and older ones who already know C
492+
may worry about C becoming a Fortran or Cobol.
493+
* Companies employing Git developers think "git already won" and
494+
redeploy those engineers on other problems
495+
* Will the combination of issues above result in folks who want improvements
496+
deciding their best bet is not improving Git but in creating/funding
497+
an alternative? Will that snowball?
498+
499+
<br />
500+
To me, the entry of new projects like [JJ][jujutsu] and [sapling][sapling]
501+
suggest the above are real concerns already rather than just theoretical.
502+
Both projects have compelling things that git lacks. I like the friendly
503+
competition, and the JJ and sapling developers are awesome to talk to
504+
at Git Merge conferences. But there is a risk that this friendly
505+
competition mirrors that of Git and Mercurial from years past, and
506+
that Git at some future point down the road ends up on the other side
507+
of that history and gets largely displaced by the alternatives. I'd
508+
rather not see that happen, but I sometimes wonder if we're taking
509+
enough measures to avoid marching towards such an outcome.
510+
511+
512+
[thalia]: https://discord.com/channels/1042895022950994071/1361310935427584213/1361316878819131452
513+
[luca]: https://public-inbox.org/git/[email protected]/
514+
[seiki]: https://public-inbox.org/git/[email protected]/
515+
[elijah]: https://public-inbox.org/git/CABPp-BH2yH4iJ28Bo7Q=uryu68LLk7a0Tvb2SzAbAiHK8QpRug@mail.gmail.com/
516+
[squash-merge]: https://git-scm.com/docs/git-merge#Documentation/git-merge.txt---squash
517+
[submodule]: https://git-scm.com/docs/git-submodule
518+
[bisect]: https://git-scm.com/docs/git-bisect
519+
[range-diff]: https://git-scm.com/docs/git-range-diff
520+
[sparse-index]: https://git-scm.com/docs/sparse-index
521+
[merge-ort]: https://git-scm.com/docs/merge-strategies#Documentation/merge-strategies.txt-ort
522+
[jujutsu]: https://github.com/jj-vcs/jj?tab=readme-ov-file#introduction
523+
[git-backend-nosql]: https://www.kenneth-truyers.net/2016/10/13/git-nosql-database
524+
[notedb]: https://www.gerritcodereview.com/notedb.html
525+
[bobby-tables]: https://xkcd.com/327/
526+
[libgit2]: https://libgit2.org/
527+
[sapling]: https://sapling-scm.com/
195528

196-
TODO
197529

198530
### Short Q&A with our maintainer, Junio C Hamano
199531

0 commit comments

Comments
 (0)