我正在使用Eclipse的Git插件。 为了更新我的工作目录,我曾经做过Pull或者Fetch + Merge 。 当要解决冲突时,我使用合并工具 。 但最近我尝试了一种新的方法。
要查看其他人已更改的内容,我会执行Fetch ,然后执行Synchronize Workspace 。 如果我在团队同步视图中直接更新我的代码后尝试执行提交和推送 ,我就会遇到“拒绝 - 非快进”错误。
我想知道我是否可以使用团队同步视图更新我的工作目录,或者如果只通过Egit的合并操作来实现它。
I'm working with the Git plugin for Eclipse. To update my working directory, I used to do a Pull or a Fetch+Merge. When there is a conflict to resolve, I use the merge tool. But recently I tried a new approach.
To see what have been changed by others, I do a Fetch and after that, a Synchronise Workspace. If I try to do a commit and push after updating my code directly within the team synchronise view, I've got the "rejected-non-fast-forward" error.
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 merge action of Egit.
最满意答案
“同步工作空间”和团队视角只是显示更改的其他方式。 两者都不修改底层的git工作流。 在推送到共享存储库时,总是必须在提交更改之前合并传入的更改。
但是,如果您始终只希望将传入的更改与您自己的本地更改合并,那么您可能希望查看本地分支的“rebase”拉策略 。 这基本上会暂时删除您自己的更改,将远程更改拉入您的分支并重新应用您自己的本地更改。 如果发生合并冲突,您仍然必须解决它们。
"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.
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.
更多推荐
发布评论