<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Git 2.54 发布：新增 &#96;git history&#96; 命令、配置文件定义钩子、几何重打包成为默认维护策略]]></title><description><![CDATA[<p dir="auto">Git 2.54 于 4 月 20 日正式发布，来自 137 名贡献者（66 名首次参与）的提交合并进入这一版本，同时覆盖 2.53 的新特性。最大亮点是新增实验性命令 <code>git history</code>，提供 <code>reword</code> 与 <code>split</code> 两个子命令：<code>git history reword &lt;commit&gt;</code> 可直接在编辑器中修改任意历史提交的提交信息，并自动更新所有下游分支，全程不触碰工作区或暂存区，甚至支持裸仓库；<code>git history split &lt;commit&gt;</code> 则以类似 <code>git add -p</code> 的交互界面将一个提交拆分成两个，自动重写后代分支——该命令底层基于 <code>git replay</code> 的核心库，有意不支持含 merge commit 的历史、也不允许产生冲突，定位为"精准、非交互式历史改写"而非 <code>rebase -i</code> 的替代。另一重要特性是配置文件定义钩子：不再要求把脚本放入 <code>.git/hooks/</code> 目录，可直接在 <code>~/.gitconfig</code> 或系统级配置中以 <code>[hook "name"] event = pre-commit</code> 的形式声明钩子，多个钩子可绑定同一事件并按顺序执行，支持通过 <code>hook.&lt;n&gt;.enabled = false</code> 单独禁用，<code>git hook list</code> 可查看来源。</p>
<p dir="auto">功能更新层面，<code>git maintenance run</code> 的默认维护策略由 <code>gc</code> 切换为 2.52 引入的 <code>geometric</code>——后者通过增量合并满足几何级数关系的 packfile，避免昂贵的全量 GC，同时保持 commit-graph 与 reflog 最新；<code>git replay</code> 新增原子引用更新（不再向 stdout 打印 update-ref 命令）、<code>--revert</code> 模式与根提交支持；<code>git log -L</code> 路由经标准 diff 管线，首次与 <code>-S</code>、<code>-G</code>、<code>--word-diff</code>、<code>--color-moved</code> 兼容；HTTP 传输新增 429 重试机制，支持 <code>Retry-After</code> 头与 <code>http.retryAfter</code>、<code>http.maxRetries</code>、<code>http.maxRetryTime</code> 配置；<code>git rebase</code> 新增 <code>--trailer</code> 选项可批量为所有被 rebase 的提交附加 trailer；<code>git blame</code> 支持 <code>--diff-algorithm</code> 参数；alias 命令名限制从 ASCII 字母数字放开至任意字符（通过 subsection 语法），使 “状態” 或 “hämta” 这样的本地语言别名成为可能；此外 MIDX 增量索引新增 compaction 支持，为长期运行的大型仓库提供更可持续的多层压缩。</p>
<p dir="auto"><a href="https://github.blog/open-source/git/highlights-from-git-2-54/" target="_blank" rel="noopener noreferrer nofollow ugc">GitHub Blog</a></p>
<p dir="auto"></p><div class="card col-md-9 col-lg-6 position-relative link-preview p-0">



<a href="https://github.blog/open-source/git/highlights-from-git-2-54/" title="Highlights from Git 2.54">
<img src="https://github.blog/wp-content/uploads/2026/04/git254.png" class="card-img-top not-responsive" style="max-height:15rem" alt="Link Preview Image" />
</a>



<div class="card-body">
<h5 class="card-title">
<a class="text-decoration-none" href="https://github.blog/open-source/git/highlights-from-git-2-54/">
Highlights from Git 2.54
</a>
</h5>
<p class="card-text line-clamp-3">The open source Git project just released Git 2.54. Here is GitHub’s look at some of the most interesting features and changes introduced since last time.</p>
</div>
<a href="https://github.blog/open-source/git/highlights-from-git-2-54/" class="card-footer text-body-secondary small d-flex gap-2 align-items-center lh-2">



<img src="https://github.githubassets.com/favicon.ico" alt="favicon" class="not-responsive overflow-hiddden" style="max-width:21px;max-height:21px" />









<p class="d-inline-block text-truncate mb-0">The GitHub Blog <span class="text-secondary">(github.blog)</span></p>
</a>
</div><p></p>
]]></description><link>https://welinux.com//topic/76/git-2.54-发布-新增-git-history-命令-配置文件定义钩子-几何重打包成为默认维护策略</link><generator>RSS for Node</generator><lastBuildDate>Sat, 02 May 2026 19:30:21 GMT</lastBuildDate><atom:link href="https://welinux.com//topic/76.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 27 Apr 2026 17:19:42 GMT</pubDate><ttl>60</ttl></channel></rss>