by clktmr · 4y ago · 0 comments
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?
Throwing 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.
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.
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.
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.Something like how the current `add -p` allows you to select or reject any given chunk.
1) Post the wrong answer.
2) Get corrected.
3) ProfitIt'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.)