TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Creating a Git Commit: The Hard Way

288 点作者 avestura9 个月前

13 条评论

jeroen9 个月前
&gt; Files in Git can be in one of these three states: Modified, Staged, Committed<p>&gt; Staged: The current version of the modified file is staged to be included in the next commit.<p>A bit of a nitpick, but if I change a file, &quot;git add&quot; it, and then change it again, both of these statements are false.
评论 #41487223 未加载
评论 #41490335 未加载
archmaster9 个月前
This is pretty cool. Worth noting that Git does not actually only store full copies of files every time you make a change, this article I found does a really good job at explaining Git&#x27;s packing: <a href="https:&#x2F;&#x2F;gist.github.com&#x2F;matthewmccullough&#x2F;2695758" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;matthewmccullough&#x2F;2695758</a>
评论 #41485252 未加载
评论 #41484782 未加载
bertylicious9 个月前
I really recommend doing the &quot;Build your own git&quot; challenge on CodeCrafters in order to gain a deep understanding of git internals.<p><a href="https:&#x2F;&#x2F;app.codecrafters.io&#x2F;courses&#x2F;git&#x2F;overview">https:&#x2F;&#x2F;app.codecrafters.io&#x2F;courses&#x2F;git&#x2F;overview</a>
评论 #41488655 未加载
chrisweekly9 个月前
Nice writeup. Reminds me of a Julia Evans post (which is the highest praise I could give it).
mirrorlake9 个月前
Reminds me of this talk [0] led by CB Bailey, a top answerer on StackOverflow for the tag &#x27;git&#x27; [1].<p>They create commits from scratch from the command line--manually creating each &#x2F;.git&#x2F; file with shell commands and a text editor. Really fun talk. Would highly recommend it for people who were planning on learning about git internals at some point.<p>[0] &quot;How does Git actually work? - CB Bailey &amp; Andy Balaam [ACCU 2019]&quot;<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=N0m42TKk_dc" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=N0m42TKk_dc</a><p>[1] <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;tags&#x2F;git&#x2F;topusers" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;tags&#x2F;git&#x2F;topusers</a>
JOnAgain9 个月前
I love blog posts like this. Content like this is what I come to hacker news for.<p>Thank you.
larusso9 个月前
Nice article. What is interesting to me is the reactions to articles like this. Not the fact that the git internals are not widely known, I mean that is true for nearly any more complicated topic. In this case I mean the fact that this is actually well documented.<p>Don’t get me wrong. I think articles like these help a lot to demystify git and I believe it makes the tool easier to use and reason with when one knows what it does. But why is nobody finding or reading the later chapters in the docs?<p><a href="https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2&#x2F;Git-Internals-Git-Objects" rel="nofollow">https:&#x2F;&#x2F;git-scm.com&#x2F;book&#x2F;en&#x2F;v2&#x2F;Git-Internals-Git-Objects</a>
评论 #41485488 未加载
评论 #41487927 未加载
grantmnz9 个月前
It was learning about the topics in this post that enabled me to create this repo:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;grantm&#x2F;no-more-f-s-repo">https:&#x2F;&#x2F;github.com&#x2F;grantm&#x2F;no-more-f-s-repo</a><p>Parental Advisory: Contains strong language.
mhh__9 个月前
&gt; git<p>On the topic, I&#x27;m just going to plug the tool git-branchless. Completely transformative for my use of git at work. Stacked commits that actually work!
评论 #41491828 未加载
breck9 个月前
Love this!<p>I think there may be an error around the &quot;git write-tree&quot; step. That or I did something wrong.<p>Here&#x27;s my user test: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=bul4CPRkv6c" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=bul4CPRkv6c</a>
AndreasHae9 个月前
Fantastic article! It seems to me that the flexibility of low-level git objects would lend itself to be embedded in other software systems for version control purposes (e.g. tracking changes in a CMS)
forgotpwd169 个月前
Up to commit-tree, a nice programming challenge is implementing those commands from scratch.
faangguyindia9 个月前
I used to struggle with formatting my Git commit messages and often forgot the necessary Git commands.<p>Now, I&#x27;ve found a utility (made by my brother who shared it with me a few days ago and I told him to opensource it since I liked it soo much) that handles all the formatting and rewriting for me. I just write my commits, and it takes care of the rest.<p>Here&#x27;s a video demonstrating this magic (though it&#x27;s for rsync): [asciinema.org&#x2F;a&#x2F;mktcuXSPDTr2Mp1XVbo5tqhK1](<a href="https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;mktcuXSPDTr2Mp1XVbo5tqhK1" rel="nofollow">https:&#x2F;&#x2F;asciinema.org&#x2F;a&#x2F;mktcuXSPDTr2Mp1XVbo5tqhK1</a>).<p>Check out the utility here: [github.com&#x2F;zerocorebeta&#x2F;Option-K](<a href="https:&#x2F;&#x2F;github.com&#x2F;zerocorebeta&#x2F;Option-K">https:&#x2F;&#x2F;github.com&#x2F;zerocorebeta&#x2F;Option-K</a>).
评论 #41487393 未加载
评论 #41484748 未加载