简体   繁体   English

Eclipse “Git 存储库”视角与“团队同步”视角

[英]Eclipse 'Git Repository' perspective vs. 'Team Synchronizing'

I'm trying to rationalize two perspectives which seem to be related (or at least provide very similar functionality): The 'Git Repository' perspective (which I got after adding EGit), and the 'Team Synchronizing' perspective (which I think was part of the EE distribution).我试图合理化两个似乎相关(或至少提供非常相似的功能)的观点:“Git 存储库”观点(我在添加 EGit 后得到)和“团队同步”观点(我认为是EE 分布的一部分)。

As far as I can tell, I was able to get the Git Repository working (with GitHub), or at least most of the features: The 'Git Staging' Window is working fine, I'm able to commit by dragging files from 'Unstaged changes' to 'Staged changes' and then clicking the Commit icon.据我所知,我能够让Git 存储库工作(使用 GitHub),或者至少大部分功能:'Git Staging' Window 工作正常,我可以通过从 ' Unstaged changes' 到 'Staged changes',然后单击 Commit 图标。 Then I'm able to push my changes from the 'Git Repositories' window, by right clicking on the workspace->Remotes->origin->url, and select Push from menu (is that the 'correct' procedure?).然后我可以从“Git 存储库”window 推送我的更改,方法是右键单击工作区->远程->来源->url,然后从菜单 select 推送(这是“正确的”程序吗?)。

With the 'Team Synchronizing' perspective, I'm no luck to even set it up.从“团队同步”的角度来看,我连设置它都没有运气。 Once selecting the 'Synchronize...' frmo the menu, the Git, then I see a table (what is it?).从菜单 Git 选择“同步...”后,我会看到一个表格(它是什么?)。 I'm trying various values for the Destination (otherwise, unable to hit the Finish button), but no matter what I do, it tells me 'no changes' for all my projects.我正在为 Destination 尝试各种值(否则,无法点击 Finish 按钮),但无论我做什么,它都会告诉我所有项目“没有变化”。

There are also many context-menu item when right clicking on a project, and selecting 'Team'.右键单击项目并选择“团队”时,还有许多上下文菜单项。 What are these?这些是什么?

In CVS the Team Synchronize is about the only sane way of managing your incoming and outgoing changes.在 CVS 中,Team Synchronize 是管理传入和传出更改的唯一明智方法。 You can update / merge incoming changes and commit outgoing changes from this one view.您可以从这个视图更新/合并传入的更改并提交传出的更改。 Since every commit is discrete and it is non-atomic, the view is fine for this workflow.由于每个提交都是离散的并且是非原子的,因此视图适用于此工作流程。

In EGit however you already have explicit actions for adding, committing, pushing, pulling and merging.然而,在 EGit 中,您已经有了用于添加、提交、推送、拉取和合并的明确操作。 So the team synchronize is largely outside the normal workflow.所以团队同步在很大程度上是在正常工作流程之外的。 It behaves much like a glorified synching from a patch - you pick which branch(s) you wish to compare your working directory and it shows you the differences.它的行为很像来自补丁的美化同步——你选择你希望比较你的工作目录的分支,它会向你显示差异。 You can then apply those changes en masse or individually but it's not going to pick up the context, ie it's not going to create merge points or whatnot.然后您可以整体或单独应用这些更改,但它不会选择上下文,即它不会创建合并点或诸如此类的东西。

So you should train yourself not to use except for exceptional reasons.所以你应该训练自己除非有特殊原因不要使用。 For example, maybe you have two branches A & B. Somebody committed a change to B and you need only a small part of it, so you could use Team Sync to show the diffs and only apply the ones you need.例如,也许您有两个分支 A 和 B。有人对 B 提交了更改,而您只需要其中的一小部分,因此您可以使用 Team Sync 来显示差异并仅应用您需要的。 Or maybe you just want to squash up all the changes on branch B and call them a single commit in A. Then you might use Team Sync rather than screwing around with a rebase when you're going to toss B anyway or its a remote branch.或者你可能只是想压缩分支 B 上的所有更改并将它们称为 A 中的单个提交。然后你可能会使用 Team Sync 而不是在你无论如何要扔 B 或其远程分支时使用 rebase .

From my understanding, the "Git repository" perspective is intended for committing files from the working directory to the local Git repository, while the "Team synchronizing" perspective is for syncing your local repository with a remote one.根据我的理解,“Git 存储库”透视图用于将文件从工作目录提交到本地 Git 存储库,而“团队同步”透视图用于将本地存储库与远程存储库同步。

I found this confusing at first as well, because when using SVN, the "Team sync" perspective was for committing/updating files.一开始我也觉得这很困惑,因为在使用 SVN 时,“团队同步”视角用于提交/更新文件。 Until I noticed that in EGit's Team sync perspective, instead of showing the commit/update buttons, it has the pull/push buttons, which are for syncing two Git repositories.直到我注意到在 EGit 的团队同步透视图中,它没有显示提交/更新按钮,而是具有拉/推按钮,用于同步两个 Git 存储库。

For the various options that appear under the "Team" context menu, they correspond to a bunch of Git operations.对于出现在“Team”上下文菜单下的各种选项,它们对应着一堆Git操作。 I'd suggest some reading about Git's principle of operation before using EGit.我建议在使用 EGit 之前阅读一些关于 Git 操作原理的文章。 http://git-scm.com/doc would be a good start. http://git-scm.com/doc将是一个好的开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM