git Eclipse EGit Checkout 与文件冲突:- EGit 不想继续
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18050220/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse EGit Checkout conflict with files: - EGit doesn't want to continue
提问by Paul Verest
I've started Eclipse EGit. In some scenarios it is really not comprehensive.
我已经启动了 Eclipse EGit。在某些情况下,它确实不全面。
I have local file e.g. pom.xml changed. On git server this file was changed.
I do pull
, EGIt says:
我更改了本地文件,例如 pom.xml。在 git 服务器上,此文件已更改。我愿意pull
,EGIt 说:
Checkout conflict with files:
签出与文件冲突:
i.e. pulling stops (fetch
is done, but not merge
), that is OK. However the next is bad experience.
即拉动停止(fetch
已完成,但未完成merge
),没关系。然而接下来是糟糕的经历。
I synchronize workspace, put my changes aside and make it the same as FETCH_HEAD. But EGit doesn't want to continue. I replace the file with HEAD revision. But EGit still doesn't want to continue.
我同步工作区,将我的更改放在一边,使其与 FETCH_HEAD 相同。但是EGit不想继续。我用 HEAD 版本替换文件。但是 EGit 仍然不想继续。
What standard expected user operation should be with EGit after conflict resolution?
冲突解决后,EGit 的标准预期用户操作应该是什么?
UPDATE:
更新:
I added to index
, then marked as Merged
-> pull
still can't pass.
When I select Merge
I get the dialog
我added to index
,然后marked as Merged
->pull
仍然无法通过。
当我选择Merge
我得到对话框
I can't commit the file as it is not in list of changed files.
我无法提交该文件,因为它不在已更改的文件列表中。
回答by Jojo.Lechelt
Situation:
情况:
- You have local uncommitted changes
- You pull from the master repo
- You get the error "Checkout conflict with files: xy"
- 您有本地未提交的更改
- 你从主仓库中提取
- 您收到错误“结帐与文件冲突:xy”
Solution:
解决方案:
- Stage and commit (at least) the files xy
- Pull again
- If automerge is possible, everything is ok.
- If not, the pull merges the files and inserts the merge-conflict markers (<<<<<<, >>>>)
- Manually edit the conflicting files
- Commit and push
- 暂存并提交(至少)文件 xy
- 再拉
- 如果可以进行自动合并,则一切正常。
- 如果没有,pull 合并文件并插入合并冲突标记(<<<<<<, >>>>)
- 手动编辑冲突文件
- 提交和推送
回答by Burak Karaku?
This is the way I solved my problem:
这是我解决问题的方法:
- Right click the folder that has uncommitted changes on your local
- Click Team > Advanced > Assume Unchanged
Pull
from master.
- 右键单击本地未提交更改的文件夹
- 单击团队 > 高级 > 假设不变
Pull
从主人。
UPDATE:
更新:
As Hugo Zuletarightly pointed out, you should be careful while applying this. He says that it might end up saying the branch is up to date, but the changes aren't shown, resulting in desync from the branch.
正如Hugo Zuleta正确指出的那样,在应用它时你应该小心。他说它最终可能会说分支是最新的,但没有显示更改,导致分支不同步。
回答by Brock W.
- After closing the Conflict Error Dialog; from the Project Explorer, right click on the head of the project -> Team -> Stashes -> Stash Changes
- Enter a name for your stash. E.G. "Conflict"
- Try Pulling again. Hopefully there are no errors this time.
- From the Git Repository view, expand your repository -> Stashed Commits
- Right Click on the stash you created in step 2 -> Apply Stashed Changes
- This brings up the merge tool if it can't automatically merge it.
- Manually resolve the merge conflicts in the file/s.
- Right Click on the file editor -> Team -> Add To Index
- If you are not ready to commit the file or just don't want it in the Index, right click on the file editor -> Team -> Remove from Index.
- Cleanup: From the Git Repository view, right Click on the stash you created in step 2 -> Delete Stashed Commit
- 关闭冲突错误对话框后;在 Project Explorer 中,右键单击项目的负责人 -> Team -> Stashes -> Stash Changes
- 输入您的藏匿处的名称。EG“冲突”
- 再次尝试拉。希望这次没有错误。
- 从 Git Repository 视图中,展开您的存储库 -> Stashed Commits
- 右键单击您在第 2 步中创建的存储 -> 应用隐藏更改
- 如果无法自动合并,则会显示合并工具。
- 手动解决文件中的合并冲突。
- 右键单击文件编辑器 -> 团队 -> 添加到索引
- 如果您还没有准备好提交文件或只是不想将它放在索引中,请右键单击文件编辑器 -> 团队 -> 从索引中删除。
- 清理:从 Git Repository 视图中,右键单击您在第 2 步中创建的存储 -> 删除存储提交
Your local working directory file should be be merged
您的本地工作目录文件应该被合并
回答by Gururaja Hegde
If error comes for ".settings/language.settings.xml" or any such file you don't need to git.
如果“.settings/language.settings.xml”或任何此类文件出现错误,则不需要git。
- Team -> Commit -> Staged filelist, check if unwanted file exists, -> Right click on each-> remove from index.
- From UnStaged filelist, check if unwanted file exists, -> Right click on each-> Ignore.
- 团队-> 提交-> 暂存文件列表,检查是否存在不需要的文件,-> 右键单击每个-> 从索引中删除。
- 从 UnStaged 文件列表中,检查是否存在不需要的文件,-> 右键单击每个文件-> 忽略。
Now if Staged file list empty, and Unstaged file list all files are marked as Ignored. You can pull. Otherwise, follow other answers.
现在,如果暂存文件列表为空,并且未暂存文件列表中的所有文件都标记为已忽略。你可以拉。否则,请遵循其他答案。
回答by Mathias Rieder
After you get from Eclipse the ugly CheckoutConflictException, the Eclipse-Merge Tool button is disabled.
从 Eclipse 获得丑陋的 CheckoutConflictException 后,Eclipse-Merge Tool 按钮被禁用。
Git need alle your files added to the Index for enable Merging.
Git 需要将所有文件添加到索引以启用合并。
So, to merge your Changes and commit them you need to add your files first to the index "Add to Index"and "Commit"them without "Push". Then you should see one pending pull and one pending push request in Eclipse. You see that in one up arrow and one down arrow.
因此,要合并您的更改并提交它们,您需要先将您的文件添加到索引"Add to Index"并在没有"Push" 的情况下" Commit"它们。然后您应该在 Eclipse 中看到一个挂起的拉取请求和一个挂起的推送请求。您可以在一个向上箭头和一个向下箭头中看到这一点。
If all conflict Files are in the commit, you can "pull"again. Then you will see something like:
如果所有冲突文件都在提交中,则可以再次“拉”。然后你会看到类似的东西:
\< < < < < < < HEAD Server Version \======= Local Version > > > > > > > branch 'master' of ....git
\< < < < < < < HEAD 服务器版本 \======== 本地版本 > > > > > > ....git 的分支 'master'
Then you either change it by the Merge-Tool, which is now enable or just do the merge by hand direct in the file. In the last step, you have to add the modified files again to the index and "Commit and Push"them.
然后您可以通过合并工具更改它,该工具现在已启用,或者直接在文件中手动进行合并。在最后一步中,您必须再次将修改后的文件添加到索引中并“提交并推送”它们。
Checking done!
检查完毕!
回答by Zafar Nasim
The proper solution is the one provided by @Jojo.Lechelt.
正确的解决方案是@Jojo.Lechelt 提供的解决方案。
However if you don't want to commit for any reason and still want to pull the changes,you may save your changes somewhere else,replace the conflicting file with HEAD revision and then pull.
但是,如果您出于任何原因不想提交但仍想拉取更改,则可以将更改保存在其他地方,将冲突文件替换为 HEAD 修订版,然后拉取。
Later you can paste your changes again and compare it with HEAD and incorporate other people changes into your file.
稍后您可以再次粘贴您的更改并将其与 HEAD 进行比较,并将其他人的更改合并到您的文件中。
回答by Kalpesh Manersure
Right click on the project and select [replace with] -> Head Revision .Now select pull changes in current branch or pull changes from upstream.
右键单击项目并选择 [replace with] -> Head Revision 。现在选择 pull changes in current branch 或 pull changes from upstream。
回答by Pritam Banerjee
I guess the best way to do this is like this :
我想最好的方法是这样的:
- Store all your changes in a separate branch.
- Then do a hard reset on the local master.
- Then merge back your changes from the locally created branch
- Then commit and push your changes.
- 将所有更改存储在单独的分支中。
- 然后在本地主服务器上进行硬重置。
- 然后从本地创建的分支合并回您的更改
- 然后提交并推送您的更改。
That how I resolve mine, whenever it happens.
这就是我如何解决我的问题,无论何时发生。