【发布时间】:2013-09-25 13:09:58
【问题描述】:
我确实尝试了很多方法,但我不知道真正发生了什么以及如何解决它:
有两个 git repos:远程和本地(在我的机器上)。
由于我正在学习,因此我尝试了代码并在本地文件中进行了许多更改。通常然后我对每个更改的文件进行还原,然后从远程存储库中提取项目的实际版本。
但是现在我有一个文件(例如hello.jsp)由我更改并且这些更改已提交。之后,我提交了几次与其他文件相关的其他更改。
现在我想用来自远程仓库的相同文件替换我的本地hello.jsp。所以我做了git pull --rebase 并得到了合并冲突:
Applying: merge fixed
Using index info to reconstruct a base tree...
M hello.jsp
<stdin>:10: trailing whitespace.
function showHello() {
<stdin>:11: trailing whitespace.
<stdin>:12: trailing whitespace.
document.getElementById('q').style.display = 'none';
<stdin>:13: trailing whitespace.
document.getElementById('w').style.display = 'none';
<stdin>:14: trailing whitespace.
document.getElementById('e').style.display = '';
warning: squelched 120 whitespace errors
warning: 125 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging hello.jsp
CONFLICT (content): Merge conflict in hello.jsp
Failed to merge in the changes.
Patch failed at 0001 merge fixed
The copy of the patch that failed is found in:
d:/repo/helloProject/.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".
嗯..首先我尝试手动删除我记得的所有更改。但即使我使用某种“显示差异”,也需要很长时间才能发现所有细节都已更改(相信我“hello.jsp”非常庞大) 我很惭愧,但我现在不知道该怎么办。
我尝试做git reset "hello.jsp" 并尝试做git checkout "hello.jsp",但没有成功。如何简单地将我的“hello.jsp”替换为远程仓库中的另一个?
【问题讨论】:
-
就不能解决hello.jsp中的合并冲突吗?打开它,搜索字符串
<<<<<<<<,然后选择你想要的版本。