文本对比
并排或统一 diff 方式比较两段文本、配置文件,标出被替换行中真正改变的单词,并可复制补丁。
完全在浏览器中运行 — 粘贴的内容不会被上传。
- 11{
- 22 "name": "ryuslog-api",
- 3- "version": "1.3.2",
- 3+ "version": "1.4.0",
- 44 "scripts": {
- 55 "dev": "next dev",
- 6- "build": "next build"
- 6+ "build": "next build",
- 7+ "lint": "eslint ."
- 78 },
- 89 "dependencies": {
- 910 "next": "16.2.10",
- 10- "react": "19.2.4"
- 11+ "react": "19.2.5"
- 12+ },
- 13+ "devDependencies": {
- 14+ "eslint": "^9"
- 1115 }
- 1216}
被替换行中真正改变的单词以更深的颜色标出。复制统一 diff 会生成带 3 行上下文的 ---/+++/@@ 补丁。
diff 参考
快速参考- + 行
- 只存在于修改版本中的行,也是评审者最先读的部分。
- - 行
- 从原始版本中删除的行。
- git diff -w
- 忽略仅空白不同的改动,例如重新缩进,让真正的变化更清晰。
- @@ -1,4 +1,6 @@
- 区块头,统一 diff 中随后的原始范围与修改范围。
- git diff --stat
- 在打开完整补丁前,按文件汇总新增和删除行数。
- LCS
- diff 基于行的最长公共子序列计算,因此移动的代码块会显示为删除加新增。
Git 相关语法指南
全部 Git 指南Git Push Rejected GH001: Large Files and History Rewrite
The 100 MB limit applies to every blob in the pushed history, so deleting the file does not help. Find the object, rewrite with filter-repo, or migrate to LFS.
GitGit Tags: Lightweight vs Annotated and SemVer Release Tags
An annotated tag stores the tagger, date, and message; describe and --follow-tags only use those. How v:refname sorting and versionsort.suffix fix pre-release order.
GitGit Detached HEAD and Non-Fast-Forward Push Rejected
A detached HEAD records commits on no branch, and a rejected push protects commits you do not have. Recover with a branch and reflog; integrate before pushing.
GitGit detected dubious ownership: Docker, Compose, and CI Fixes
A bind mount keeps the host UID and the container runs as root, so Git stops before reading a single object. Trust the path Git resolves, not the one you mounted.