Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] zh-cn document translate: git parts #15576

Merged
merged 5 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Dasky <[email protected]>
  • Loading branch information
epiciskandar and daskygit committed Jan 27, 2022
commit 759737ffac1a02c3a924f39cac8cb17d07c8b69f
4 changes: 2 additions & 2 deletions docs/zh-cn/newbs_git_best_practices.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# QMK所采用的Git最佳实践

epiciskandar marked this conversation as resolved.
Show resolved Hide resolved
<!---
original document: 0.15.12:docs/newbs_git_best_practices.md
git diff 0.15.12 HEAD -- docs/newbs_git_best_practices.md | cat
original document: 0.15.17:docs/newbs_git_best_practices.md
git diff 0.15.17 HEAD -- docs/newbs_git_best_practices.md | cat
-->

*译者注:对于git相关的部分,除广为接受的名词外,会尽量保留git命令及各种术语的英文版本,部分名词及关键部分会附带中文翻译*
Expand Down
7 changes: 3 additions & 4 deletions docs/zh-cn/newbs_git_resolving_merge_conflicts.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# 解决合并冲突

epiciskandar marked this conversation as resolved.
Show resolved Hide resolved
<!---
original document: 0.15.12:docs/newbs_git_resolving_merge_conflicts.md
git diff 0.15.12 HEAD -- docs/newbs_git_resolving_merge_conflicts.md | cat
original document: 0.15.17:docs/newbs_git_resolving_merge_conflicts.md
git diff 0.15.17 HEAD -- docs/newbs_git_resolving_merge_conflicts.md | cat
-->

有时在你致力于一个较长周期才能完成的分支时,其它人提交的变更会与你提交的pull request中的变更发生冲突。我们将这种多个人编辑同一个模块同一个文件时产生的场景叫做 *合并冲突*

?> 本文中的场景基于[在你Fork的主干上:频繁更新,不要提交](zh-ch/newbs_git_using_your_master_branch.md)一文。如果你对那篇文章不熟悉,请先阅读它,再回来继续。
?> 本文中的场景基于[在你Fork的主干上:频繁更新,不要提交](zh-cn/newbs_git_using_your_master_branch.md)一文。如果你对那篇文章不熟悉,请先阅读它,再回来继续。

## 变基/衍合(rebase)

*译注:(git新手请跳过这一段译注)大部分开源仓库倾向于rebase而不是merge,是因为commit tree的整洁要比精确记录你的各个commit更重要,并且冲突场景非常多。参见[rebase VS merge](https://www.zhoulujun.cn/html/tools/VCS/git/5838.html),及[官方文档](https://git-scm.com/book/zh/v2/Git-%E5%88%86%E6%94%AF-%E5%8F%98%E5%9F%BA)*

Git的*变基*操作会将提交历史中的提交节点摘除并回滚,然后统一提交到一个新节点上。在解决合并冲突时,可以通过对当前分支进行变基,来获取从分支拉取到当前时刻的所有变更。

Expand Down
8 changes: 4 additions & 4 deletions docs/zh-cn/newbs_git_resynchronize_a_branch.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# 重新同步已失去同步状态的Git分支

epiciskandar marked this conversation as resolved.
Show resolved Hide resolved
<!---
original document: 0.15.12:docs/newbs_git_resynchronize_a_branch.md
git diff 0.15.12 HEAD -- docs/newbs_git_resynchronize_a_branch.md | cat
original document: 0.15.17:docs/newbs_git_resynchronize_a_branch.md
git diff 0.15.17 HEAD -- docs/newbs_git_resynchronize_a_branch.md | cat
-->

假设你在自己的 `master` 分支之上有提交,并且想和QMK仓库进行同步,可以通过 `git pull` 拉取QMK的 `master` 分支到你的库,但同时Github也会提醒你当前分支相比 `qmk:master` 有几个领先的提交,会在你向QMK发起pr时造成麻烦。

?> 本文中的场景基于[在你Fork的主干上:频繁更新,不要提交](zh-ch/newbs_git_using_your_master_branch.md)一文。如果你对那篇文章不熟悉,请先阅读它,再回来继续。
?> 本文中的场景基于[在你Fork的主干上:频繁更新,不要提交](zh-cn/newbs_git_using_your_master_branch.md)一文。如果你对那篇文章不熟悉,请先阅读它,再回来继续。

## 备份你在自己的主干分支上的所有变更(可选)

Expand Down Expand Up @@ -73,4 +73,4 @@ git push --force-with-lease

!> **不要**在其它使用者也会提交的分支上执行 `git push --force-with-lease`,否则会覆盖掉他人的提交。

此时你的Github fork,本地文件副本,以及QMK仓库就是一致的了。之后再进行变更([在分支上!](newbs_git_using_your_master_branch.md#making-changes))和提交。
此时你的Github fork,本地文件副本,以及QMK仓库就是一致的了。之后再进行变更([在分支上!](zh-cn/newbs_git_using_your_master_branch.md#making-changes))和提交。
4 changes: 2 additions & 2 deletions docs/zh-cn/newbs_git_using_your_master_branch.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 在你Fork的主干上:频繁更新,不要提交

epiciskandar marked this conversation as resolved.
Show resolved Hide resolved
<!---
original document: 0.15.12:docs/newbs_git_using_your_master_branch.md
git diff 0.15.12 HEAD -- docs/newbs_git_using_your_master_branch.md | cat
original document: 0.15.17:docs/newbs_git_using_your_master_branch.md
git diff 0.15.17 HEAD -- docs/newbs_git_using_your_master_branch.md | cat
-->

我们强烈推荐所有QMK开发者,无论在哪里做什么改动,频繁更新你的 `master` 分支,但***不要***在其上提交。相对地,将你所有的改动提交到开发分支上并提交一个pull request。
Expand Down