eclipse 通过同步工作区的 EGit 更新我的 git 工作目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16187739/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 20:24:18  来源:igfitidea点击:

Update my git working directory via EGit with Synchronise Workspace

eclipseegit

提问by naike

I'm working with the Git plugin for Eclipse. To update my working directory, I used to do a Pullor a Fetch+Merge. When there is a conflict to resolve, I use the merge tool. But recently I tried a new approach.

我正在使用 Eclipse 的 Git 插件。为了更新我的工作目录,我曾经执行过PullFetch+Merge。当有冲突需要解决时,我使用合并工具。但最近我尝试了一种新方法。

To see what have been changed by others, I do a Fetchand after that, a Synchronise Workspace. If I try to do a commit and pushafter updating my code directly within the team synchronise view, I've got the "rejected-non-fast-forward" error.

要查看其他人更改了哪些内容,我执行了Fetch,然后执行了Synchronize Workspace。如果我在团队同步视图中直接更新我的代码后尝试进行提交和推送,我会收到“rejected-non-fast-forward”错误。

I want to know if I can update my working directory using the team synchronise view or if the only way to do that it's via the mergeaction of Egit.

我想知道我是否可以使用团队同步视图更新我的工作目录,或者是否唯一的方法是通过Egit的合并操作。

回答by Bananeweizen

"Synchronize workspace" and the team perspective are just other ways to display the changes. Both do not modify the underlying git workflow. You always have to merge incoming changes before committing your changes, when pushing to a shared repository.

“同步工作区”和团队视角只是显示更改的其他方式。两者都不会修改底层 git 工作流程。推送到共享存储库时,您始终必须在提交更改之前合并传入的更改。

However, if you always just want incoming changes to be merged with your own local changes, then you might want to have a look at the "rebase" pull strategy of your local branch. That basically temporarily removes your own changes, pulls the remote changes into your branch and re-applies your own local changes. You will still have to resolve merge conflicts, if they occur.

但是,如果您总是只想将传入的更改与您自己的本地更改合并,那么您可能需要查看本地分支“rebase”拉取策略。这基本上会暂时删除您自己的更改,将远程更改拉入您的分支并重新应用您自己的本地更改。如果发生合并冲突,您仍然需要解决它们。