从远程仓库拉取时无法解决 git 冲突
can not solve git conflicts when pulling from remote repo
当我提取最后一次提交时,我收到以下错误消息:
C:\laragon\www\wordpress\wp-content\themes\chihab-twig>git pull
First, rewinding head to replay your work on top of it...
Applying: disable Timber cache
Using index info to reconstruct a base tree...
M functions.php
Falling back to patching base and 3-way merge...
Auto-merging functions.php
CONFLICT (content): Merge conflict in functions.php
error: Failed to merge in the changes.
Patch failed at 0001 disable Timber cache
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
当我在我的文本编辑器中修复冲突并提交更改时,我收到以下消息:
[detached HEAD b66d68b] fix conflict
1 file changed, 4 insertions(+)
但是当我切换到"master"时,我发现没有任何更改被拉取。
这有什么问题吗?
您的默认合并策略已设置为变基而不是合并。
变基的过程与合并不同。变基返回到您的更改起源的位置(输出中的倒带 HEAD 消息),然后按顺序应用每个提交的变更集。如果存在无法自动解决的冲突,它会停止。这就是你要做的。
完成更改(解决冲突)后,使用 git add my/file
然后 git rebase --continue
完成合并。
它本质上是将冲突的解决放在发生冲突的提交中。就好像冲突从未发生过一样 - 您的更改现在基于与您开始时不同的起点。
您可以考虑将您的合并策略更改为默认策略以避免变基。是 rebase 还是进行常规合并是基于许多因素的决定(超出了这个问题的范围)。
当我提取最后一次提交时,我收到以下错误消息:
C:\laragon\www\wordpress\wp-content\themes\chihab-twig>git pull
First, rewinding head to replay your work on top of it...
Applying: disable Timber cache
Using index info to reconstruct a base tree...
M functions.php
Falling back to patching base and 3-way merge...
Auto-merging functions.php
CONFLICT (content): Merge conflict in functions.php
error: Failed to merge in the changes.
Patch failed at 0001 disable Timber cache
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
当我在我的文本编辑器中修复冲突并提交更改时,我收到以下消息:
[detached HEAD b66d68b] fix conflict
1 file changed, 4 insertions(+)
但是当我切换到"master"时,我发现没有任何更改被拉取。 这有什么问题吗?
您的默认合并策略已设置为变基而不是合并。
变基的过程与合并不同。变基返回到您的更改起源的位置(输出中的倒带 HEAD 消息),然后按顺序应用每个提交的变更集。如果存在无法自动解决的冲突,它会停止。这就是你要做的。
完成更改(解决冲突)后,使用 git add my/file
然后 git rebase --continue
完成合并。
它本质上是将冲突的解决放在发生冲突的提交中。就好像冲突从未发生过一样 - 您的更改现在基于与您开始时不同的起点。
您可以考虑将您的合并策略更改为默认策略以避免变基。是 rebase 还是进行常规合并是基于许多因素的决定(超出了这个问题的范围)。