Renyddd Site
Created: 02 Jan 2023

GitHub 解决 sync fork冲突

在今天日常从 purcell/emacs.d 同步变更时,终于迎来了自己在 GitHub 上的第一个冲突,特以此记录解决过程。

github-dot-emacs-sync_2023-01-02_21-27-34.png

创建 Pull Request 解决冲突

由仓库提示的 commit behind 处点入,并被告知此冲突需要 Pull Request 提交解决后,便会进入 Pull Request 创建页面。

This branch is 46 commits ahead, 3 commits behind purcell:master.

Can’t automatically merge. Don’t worry, you can still create the pull request.

dotemas-creat-pr-2023-01-02_21-47-24.png

Checking out pull requests locally

此时观察页面,并不会发现类似 GitLab 所能展示的具体冲突详情等信息,所以当前需要知道的操作是,如何将对方的修改信息拉取到本地。

根据页面提示的 CLI 解决方法,首先由 purcell-master 仓库拉取最新变更至新分支:

$ git pull https://github.com/purcell/emacs.d.git master --no-rebase
From https://github.com/purcell/emacs.d
 * branch            master     -> FETCH_HEAD
Auto-merging lisp/init-editing-utils.el
CONFLICT (content): Merge conflict in lisp/init-editing-utils.el
Automatic merge failed; fix conflicts and then commit the result.

$ gst
On branch purcell-master
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Changes to be committed:
        modified:   lisp/init-corfu.el
        modified:   lisp/init-ledger.el

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   lisp/init-editing-utils.el

修改完冲突提交之后,进行该分支到 master 的合并:

$ git checkout master
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

$ git merge --no-ff purcell-master
Merge made by the 'ort' strategy.
 lisp/init-corfu.el  | 4 ++--
 lisp/init-ledger.el | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

Merged

推送之后 Pull Requests 项将会自动显示已合并:

merged_2023-01-02_22-25-34.png
Creative Commons License
renyddd by Renyddd is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.