7.8 节Git 工具-高级合并-其他类型的合并-我们的或他们的偏好-最后一段对 ours 解释模糊
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- git
- Domain
- documentation
Research direction
Start with section 7.8, “Git 工具-高级合并-其他类型的合并-我们的或他们的偏好,” and compare the final explanation of the ours strategy with issue 426 and the linked Stack Overflow discussions. Update the Chinese paragraph so the skipped commit, later bug fixes, and merge direction are unambiguous, then verify the edited documentation renders correctly.
Written by the indexing model from the issue text.
Description
现在的版本:
当再次合并时从本质上欺骗 Git 认为那个分支已经合并过经常是很有用的。 例如,假设你有一个分叉的 release 分支并且在上面做了一些你想要在未来某个时候合并回 master 的工作。 与此同时 master 分支上的某些 bugfix 需要向后移植回 release 分支。 你可以合并 bugfix 分支进入 release 分支同时也 merge -s ours 合并进入你的 master 分支 (即使那个修复已经在那儿了)这样当你之后再次合并 release 分支时,就不会有来自 bugfix 的冲突。
修改后容易理解的版本:
如果在合并操作中要跳过某个提交, 并在稍后要继续进行合并操作, 诱使Git认为分支已经合并通常是有帮助的. 假设你分出了一个名为release的分支, 在该分支上完成了一些工作, 希望之后将release分支合并回master分支. 在此之间, 在master分支上进行的一些bug修复工作需要向后移植到release分支, 你可以将master分支合并入release分支. 随后, 如果master分支有一个提交A的内容不想合并到release分支, 但是在这个提交A之后的还未出现的bug修复预计会继续合并到release分支, 这时可以使用merge -s ours将master合并入release分支.
参考资料:
https://github.com/progit/progit2/issues/426
英文版也有很多人不理解在讲什么
stackoverflow 上对 ours 使用场景解释比较全面的回答
https://stackoverflow.com/questions/5077688/why-would-one-use-git-merge-s-ours
https://stackoverflow.com/questions/727994/git-skipping-specific-commits-when-merging/729723
- Dominant language
- CSS
- Stars
- 1.6k
- Forks
- 360
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from progit/progit2-zh
-
fork 建议译作 ”分叉“ Open
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
progit/progit2-zh#541 · 1 comment ·
-
两个连字符--被渲染成了一个长破折号— Open
Difficulty 1/5 Under an hour Newbie friendliness 55/100
progit/progit2-zh#536 · 1 comment ·
-
是否需要文件末尾的新行? Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
progit/progit2-zh#526 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 42/100
progit/progit2-zh#518 · 3 comments ·
All issues in progit/progit2-zh
Similar issues
-
user-reported
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Kong/developer.konghq.com#7316 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Ecosystem: ClawMetry — the Qwen Code reader is now free and open source (follow-up to #9294 / #9338) Opencategory/integration priority/P3 scope/documentation status/ready-for-human type/feature-request
Difficulty 1/5 Under an hour Newbie friendliness 84/100