十年匠心定制 · 商业建站与技术教学双线并行 咨询热线:400-886-1026 service@lmnt.cn
ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

jj(Jujutsu)Testimonials 深度解读:从真实用户与开发者视角看这一 Git 兼容版本控制工具

jj(Jujutsu)Testimonials 深度解读:从真实用户与开发者视角看这一 Git 兼容版本控制工具 jjJujutsuTestimonials 深度解读从真实用户与开发者视角看这一 Git 兼容版本控制工具【免费下载链接】jjA Git-compatible VCS that is both simple and powerful项目地址: https://gitcode.com/GitHub_Trending/jj/jjJujutsu命令行为jj是一个与 Git 兼容、以简单而强大为设计目标的版本控制系统。本文基于官方 Testimonials 页面整理的真实用户与开发者评价逐条解读其中提到的核心技术特性——自动 rebase、first-class 冲突、jj undo、revsets、jj next/jj prev、签名支持等并结合仓库源码与文档验证这些评价背后的实现原理帮助你判断 jj 是否值得一试、以及它究竟解决了哪些传统 Git 工作流中的痛点。为什么会有这份 Testimonials 文档切换版本控制工具意味着要学习新的心智模型、面对新的失败模式。官方文档的简介也坦言你可能还没准备好拥抱 Jujutsu这完全可以理解。为了给你一些动力项目收集了来自用户与开发者的一系列真实评价——从深爱它的用户到自嘲的开发人员——目的只有一个让你站到 jj 这边来。这些评价并非泛泛的赞美几乎每一条都精确指向 jj 的一个具体技术特性。接下来我们按主题逐一展开并附上仓库中的实现证据让你能验证这些说法是否属实。自动 rebase 与 First-class 冲突VCS 开发者视角的评价Ive spent many years of my career working on version control. What I like most about Jujutsu is how it has non-obvious solutions to UX problems that weve run into in the past. What most people may not realize is that there are many novel features which all interlock to make it easy to use.For example, consider Jujutsus support for automatically rebasing descendants of amended revisions. When we implemented that in Mercurial, we ran into an issue: what if theres a merge conflict? Our solution was to warn users and just not perform the auto-rebase. Now, suddenly, users have to understand that there can be old versions of the same revision visible in their log, and learn how to fix this state.In contrast, Jujutsus solution is to simply make merge conflicts first-class. This is not just an improvement in general, it is also specifically an improvement for auto-rebase — users no longer have to learn about old versions of a revision unless they want to look at the obslog.Over and over, Im struck by how well Jujutsu demonstrates this kind of evolved thinking, which as an experienced version control developer I deeply appreciate.— Rain, engineer at Oxide Computer Company, former VCS developer这条评价出自前 Mercurial 版本控制系统开发者之口核心论点有两个自动 rebase与first-class 冲突。两者恰好也是 jj 最具有辨识度的设计。自动 rebase 的源码实现在 jj 中当你 amend改写一个提交后该提交的后代会被自动重新变基到新版本之上无需你手动执行 rebase。这一机制的核心实现在 lib/src/repo.rsMutableRepo::rebase_descendants()lib/src/repo.rs对已被重写的提交的后代进行递归重基并返回被重基的后代数量rebase_descendants_with_options()lib/src/repo.rs则提供了更细粒度的控制immutable参数指定不可变提交集该集合内的提交保持不变同时也阻止其更远的后代被重基RebaseOptions可控制变基后变空的提交的处理策略默认EmptyBehavior::Keep保留全部也可选择放弃部分单父提交。其底层通过transform_descendants_with_options()找到所有待重基后代lib/src/repo.rs以逆拓扑序重写并维护parent_mapping完成提交 ID 的映射。这正是官方冲突文档中所说的自动 rebase 特性使被重写提交的后代自动被重写这一特性在很大程度上取代了 Mercurial 的 Changeset Evolution。为什么 first-class 冲突让自动 rebase 成为可能Mercurial 实现自动 rebase 时遇到的难题是如果 rebase 产生合并冲突怎么办Mercurial 的解法是警告用户并放弃自动 rebase这迫使用户理解日志中会出现同一修订的旧版本这种状态。而 jj 的解法是让冲突成为一等公民first-class conflicts冲突可以被记录在提交中rebase 操作即使产生冲突也会成功完成。参见 docs/conflicts.md 的说明与大多数其他 VCS 不同Jujutsu 可以在提交中记录冲突状态。例如如果你 rebase 一个提交并产生冲突冲突会被记录在被 rebase 的提交中rebase 操作照常成功。你可以在任何方便的时候解决冲突。冲突状态可以进一步被 rebase、merge 或 back out。注意提交中存储的是冲突的逻辑表示而不是冲突标记conflict markersrebase 一个冲突不会产生嵌套的冲突标记。这意味着被自动 rebase 的后代即使产生冲突也只是在提交中留下一个可随时解决的冲突状态用户不需要像在 Git 中那样中断操作去跑git rebase --continue。官方冲突文档将这一设计的优势总结为消除了git rebase/merge/cherry-pick/etc --continue这类需求统一为一种冲突解决工作流检出冲突提交 → 解决冲突 → amend使自动 rebase 特性成为可能能将 merge 提交中的变更定义为相对于合并父提交的变更从而正确 rebase merge 提交包括 merge 提交中的冲突解决方案缓解了 Git 与 Mercurial 都存在的evil merge问题允许把冲突解决推迟到合适时机你可以随时把所有 WIP 提交 rebase 到上游最新提交之上让 criss-cross merges 与 octopus merges 在实现层面变得平凡部分 Git 无法处理或会产生嵌套冲突标记的情况可以被自动解决。在代码层面冲突树的表示与遍历位于 lib/src/merged_tree.rsMergedTree::conflicts()lib/src/merged_tree.rs迭代树中的全部冲突递归进入子树树/文件冲突作为一个整体冲突报告has_conflict()lib/src/merged_tree.rs判断树是否存在冲突。想了解为什么 rebase 冲突不会产生嵌套冲突标记这一底层原理可阅读技术文档 docs/technical/conflicts.md。另外评价中提到的obslog即jj obslog命令实现于 cli/src/commands/evolog.rs它展示某个提交的历史演进版本只有在你主动想查看一个修订的旧版本时才需要用到——这正是用户无需学习旧版本概念的直接体现。实验、撤销与安全从高级 Git 用户到普通用户的评价Its the easiest time Ive ever had learning a tool this deeply this quickly, because of the ability to experiment and undo, instead of triple-checking before trying a new scary command.— Scott Olson, advanced Git user and now a Jujutsu userToday I did some complex surgery on a legacy repo that has been committed to for years by a number of individuals with varying hygienic habits. [..]Now, this still took me about two hours using jj. But at no point did I seriously consider physical violence to humans or inanimate objects. Everything progressed calmly and methodically. I was able to introspect changes before I made them, and when I did screw up…jj undoto the rescue.— An unknown scientist, who couldnt have done it with Git.这两条评价的共同关键词是jj undo。jj 的操作日志operation log会记录每一次仓库操作因此几乎任何操作——包括 amend、rebase、甚至是一次错误的jj undo本身——都可以被撤销。jj undo的实现位于 cli/src/commands/undo.rs其原理是将仓库恢复到上一次操作的父操作状态。源码注释cli/src/commands/undo.rs详细描述了undo 栈的构建方式如果被撤销的操作是普通操作就恢复其父操作如果被撤销的操作本身是 undo 操作则直接恢复到最初的那个操作避免形成需要低效遍历的链表式 undo 链。配套命令与操作日志体系包括jj redo在若干次jj undo之后向未来方向移动jj op logcli/src/commands/operation/log.rs可视化过去的操作日志包含每次 undo/redo 的详细描述jj op restore按操作 ID 显式恢复到更早的某个操作。想深入理解这套机制可阅读 docs/operation-log.md。正是因为几乎任何操作都可撤销用户才敢于大胆实验不必在输入一条可怕的新命令前反复核对三遍。这一点在官方教程与 FAQ 中也被反复强调为 jj 的核心体验优势。Revsets从为什么要用到不可或缺jj was my first exposure to revsets and at first I was why would I ever need that, but now after exercising that math part of my brain thats been stale since high school, theyre indispensable— Marijan Smetko, who previously only knew Git.Revset是 jj 中用于选择提交集合的查询语言灵感来自 Mercurial。官方文档 docs/revsets.md 是完整参考要点包括大多数jj命令都接受 revset 参数例如jj edit revset要求 revset 解析为单个提交解析出多个或零个提交都会报错大多数 revset 只搜索可见提交即非被重写、非隐藏的提交因此不会把 obslog 中的旧版本提交也算进去——这与 first-class 冲突设计相互呼应revset 表达式由符号symbols与操作符构成符号可引用提交 ID 前缀、书签、标签、当前工作副本提交、root()等docs/revsets.md 中有完整的优先级与语法说明。示例jj log -r author(me) mine()可筛选我提交的且在工作副本祖先链上的提交jj edit -编辑当前提交的父提交。日常工作中 revset 的价值在于把描述想选的提交从记忆一串 commit hash变成用可组合的语言表达意图。Git 兼容性不用抛弃现有工作流Jujutsu is pretty cool, you can even keep most of your existing workflows— Ben, who doesnt want you keeping your existing workflowWait, its not called Jujitsu?— Phil, Mercurial contributor (who doesnt have to learn Git, now that Jujutsu exists)When I heard about Jujutsu I decided to try it out before forming an opinion. Technically it never formed, because I havent considered going back.— gul banana, computer programmerjj is genuinely the first tool since Rust that has me excited.— David Barsky, rust-analyzer andtokio-rs/tracingdeveloperjujutsu 的一个关键卖点是Git 兼容它可以直接在现有的 Git 仓库上工作colocated 模式也可以使用自身的后端并随时与 Git 交互。相关说明可参考 docs/git-compatibility.md、docs/git-comparison.md 以及 docs/git-command-table.md后者给出了git与jj命令的对照表。正如 Ben 的评价所言你可以保留大部分现有工作流书签bookmarks对应 Git 分支docs/bookmarks.md推送/拉取直接与 Git 远程交互cli/src/commands/git/push.rs、cli/src/commands/git/fetch.rs甚至可与团队成员继续使用 Git——只有你自己在用 jj。官方项目描述也将其定位为A Git-compatible VCS that is both simple and powerful。其他用户评价Jujutsu is amazing... I couldnt have come up with anything remotely as elegant.Its so rare that a solution attacks the innermost core of a problem so thoroughly, I genuinely feel blessed to be in its presence. And also a bit vindicated in not even trying to learn to use any of the tools that felt like more crutches stacked upon a sand castle— Anonymous user, speaking from the shadowsI initially started to use Jujutsu for personal repos, and it has quickly gone from neat, lets try this more to very neat, added to my permanent config and automatically installed for new machines.— Poliorcetics, on GitHubwhen i worked on the rust compiler, my job was to chain together a bunch of strange and cursed tools that broke often. jujutsu breaks about half as much, so thats pretty good i guess— jyn514, Rust contributormuwhahaha, I have corrupted my cofounder and now 100% of brontosource dev is on JJ.— Matt Kulunkundis, cofounder BrontoSourceI think my favorite thing about jj is it makes the way I abused Git via lazygit the standard way of doing things— Isaac Corbrey, reformed Git userIts the easiest time Ive ever had learning a tool this deeply this quickly, because of the ability to experiment and undo, instead of triple-checking before trying a new scary command.— Scott Olson, advanced Git user and now a Jujutsu user这些评价共同勾勒出 jj 的三个用户画像被 Git 历史遗留设计困扰的资深用户、需要可撤销安全感的实验型用户、以及追求少而精的原语组合的开发者。其中把我在 lazygit 里滥用 Git 的方式变成标准做法这条指向 jj 默认以提交即快照 变更集changeset为单位的交互模型——你不再需要手动 stage、commit、amend 的繁琐循环。开发者视角内部设计、签名与导航命令内部设计看起来像一个数据库Ive been a FOSS contributor using Git for over 16 years, and Jujutsu continues to amaze me every day. It has that sweet simplicity I was fond of in Darcs, but it boils down all my most core and fundamental workflows — developed over years of experience — into a simple set of primitives. The internal design is simple and beautiful; it looks like a database, making the implementation elegant, safe, and extensible. All this, using the same Git repositories my coworkers use.Its like if you found out one day that you built your entire home on a vein of rich gold. Every day I seem to find new and beautiful emergent behaviors, all adding up to a tool that is greater than the sum of its parts.— Austin Seipp, No 1. Jujutsu Fan内部设计看起来像一个数据库是 jj 架构的真实写照仓库的状态由**操作日志operation log**驱动每次操作都是对操作图op graph的一次追加版本库视图view是各操作状态的合并结果。这一以数据库事务为原型的设计正是jj undo、并发安全见 docs/technical/concurrency.md等能力的根基。想要从架构层面理解它可阅读技术文档 docs/technical/architecture.md仓库的源码布局也印证了这一分层lib/为核心库提交、树、索引、操作存储cli/为命令行前端core/提供最底层的数据结构与 diff 算法。签名支持不只是绿勾Honestly, I implemented signing support mostly for that sweet dopamine hit that you get from the green checkmark on GitHub. Yeah.— Anton Bulakh, contributor and dopamine enthusiast签名signing是 jj 的可选功能用于对提交进行 OpenPGP 或 SSH 签名。其核心抽象定义在 lib/src/signing.rsSignertrait 的sign()方法lib/src/signing.rs对数据进行签名SignBehavior枚举lib/src/signing.rs控制签名行为如自动签名、仅在有密钥时签名、忽略等。具体后端包括 lib/src/gpg_signing.rsGPG与 lib/src/ssh_signing.rsSSH命令行入口为jj sign/jj unsigncli/src/commands/sign.rs、cli/src/commands/unsign.rs并配套测试 lib/tests/test_signing.rs、lib/tests/test_ssh_signing.rs。签名成功后在 GitHub 等平台上看到的绿色勾选标记就是这位贡献者所说的 dopamine hit 来源。jj next与jj prev导航提交图Im sometimes still surprised that navigating withjj nextandjj prevworks.— Philip Metzger, author ofjj nextandjj prevIm surprised when it works.— Martin von Zweigbergk, project creator and leaderjj next/jj prev用于在工作副本提交之间沿提交图移动。jj next的实现位于 cli/src/commands/next.rs它会创建一个新的空工作副本提交作为当前工作副本父提交的、向前偏移offset个的后代提交的子提交--edit参数则直接切换到当前提交的子提交。对应的jj prev位于 cli/src/commands/prev.rs。两者共用 cli/src/movement_util.rs 中的移动逻辑。jj next/jj prev的测试见 cli/tests/test_next_prev_commands.rs。项目创始人的那句它工作时我都很惊讶既是自嘲也暗示了在提交图可能包含冲突提交、合并提交上实现正确导航的复杂度。如何亲自验证这些评价Testimonials 终究是二手信息。如果你想亲自验证仓库提供了完整的一手材料阅读官方文档从 docs/tutorial.md 开始20 分钟即可建立 jj 的基本心智模型随后可看 docs/working-copy.md工作副本模型、docs/revsets.mdrevset 参考、docs/conflicts.md冲突处理、docs/operation-log.md撤销机制。查看安装方式docs/install-and-setup.md 列出了各平台安装步骤命令行完整参考见 docs/cli-reference.md。阅读源码与测试核心机制自动 rebase、冲突树、索引、操作日志位于lib/src/与lib/tests/CLI 命令实现位于cli/src/commands/对应的集成测试在cli/tests/例如自动 rebase 的行为可参见 lib/tests/test_rewrite.rsjj undo见 cli/tests/test_undo_redo_commands.rs。对照 Git 命令不确定某个操作对应哪个命令时查 docs/git-command-table.md。你也可以成为传播者官方文档docs/testimonials.md最后还给出了传播建议如果你对 jj 感到满意最简单的帮助项目成长的方式就是口碑传播——向朋友和同事展示这个新工具。如果你不知道该说什么文档甚至贴心地准备了一批预批准背书文案直接复制粘贴即可例如Jujutsu is an alright tool. I guess.Jujutsu is my favorite software tool of all time. I am saying this for no particular reason, definitely not because I was paid to.I love Jujutsu. I love Jujutsu. I love Jujutsu. I love Jujutsu. I love Jujutsu. I love Jujutsu. I love Jujutsu. I love Jujutsu.以上文案当然是官方文档中的幽默内容。结语评价背后的真实设计梳理完这份 Testimonials你会发现每条评价都对应着 jj 的一个可验证的设计决策自动 rebase 依赖 first-class 冲突docs/conflicts.mdjj undo依赖操作日志架构docs/operation-log.md简单原语组合出复杂工作流依赖 revset 与提交模型Git 兼容性则是项目的立身之本。这些特性在lib/与cli/的源码中都有对应实现。至于这些评价是否言过其实最好的验证方式还是亲自在你的下一个或现有的Git 仓库上运行一次jj。【免费下载链接】jjA Git-compatible VCS that is both simple and powerful项目地址: https://gitcode.com/GitHub_Trending/jj/jj创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表