使用Synchronize Workspace通过EGit更新我的git工作目录(Update my git working directory via EGit with Synchronise W

编程入门 行业动态 更新时间:2024-10-24 04:36:06
使用Synchronize Workspace通过EGit更新我的git工作目录(Update my git working directory via EGit with Synchronise Workspace)

我正在使用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.

更多推荐

本文发布于:2023-08-05 03:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1428539.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:目录   工作   git   EGit   Synchronize

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!