Eclipse 将分支从分支切换到主干

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

Eclipse switching branch from branch to trunk

eclipseapache-flexsvnflex3

提问by Dave

I don't understand something that is happening on my Eclipse and I am wondering if this is my Eclipse problem or if this is actually a feature. I have a trunk and a branch. On the repository they are the same so no changes have been commited since I created the branch. After making the branch I switch on my workspace the project from trunk to branch. Then I started working and changing on the branch. Suddenly I wanted to see something on the trunk because I got lost in my changes. So I switch to the trunk. I was surprised when Eclipse did not remove my changes and it was as if no switch was made. The changes continued being there.

我不明白我的 Eclipse 上发生了什么,我想知道这是我的 Eclipse 问题还是这实际上是一个功能。我有一个树干和一个分支。在存储库中,它们是相同的,因此自从我创建分支以来没有提交任何更改。创建分支后,我在我的工作区中将项目从主干切换到分支。然后我开始在分支上工作和改变。突然我想在后备箱上看到一些东西,因为我迷失在我的变化中。所以我切换到后备箱。当 Eclipse 没有删除我的更改并且好像没有进行任何切换时,我感到很惊讶。变化继续存在。

Is this normal? Can someone explain? Thanks, David

这是正常的吗?有人可以解释一下吗?谢谢,大卫

回答by David W.

This is perfectly normal, and the way the svn switchis suppose to work.

这是完全正常的,svn switch也是假设工作的方式。

Here's a common scenario. You're working on trunk, and realize that your changes should be applied to a branch instead. You simply do switch and you are now on a new branch and your changes are now applied to the new branch. Many times, I'll be working on one stream (a branch or trunk), and realize that my changes are too experimental and big to go into the current development stream. I'll create a new branch and switch to it.

这是一个常见的场景。您正在处理主干,并意识到您的更改应该应用于分支。您只需进行切换,您现在就在一个新分支上,您的更改现在将应用于新分支。很多时候,我会在一个流(分支或主干)上工作,并意识到我的更改过于实验性和大而无法进入当前的开发流。我将创建一个新分支并切换到它。

There is no reason with gigabyte fast disks, and gigabyte networks to be skimping on working directories. I tell developers to dedicate a working directory for each project and branch. Otherwise, if they keep switching back and forth between various development streams, they're going to forget and do development in the wrong place.

千兆字节快速磁盘和千兆字节网络没有理由在工作目录上吝啬。我告诉开发人员为每个项目和分支指定一个工作目录。否则,如果他们不断在各种开发流程之间来回切换,他们就会忘记并在错误的地方进行开发。

回答by vinnyjames

With almost any svn client you can:

使用几乎所有 svn 客户端,您都可以:

  1. check out a project
  2. make some changes
  3. switch back and forth to any truck/branch
  4. preserve your changes along the way
  1. 查看一个项目
  2. 做一些改变
  3. 来回切换到任何卡车/分支机构
  4. 在此过程中保留您的更改

In other words, nothing specific to eclipse here.

换句话说,这里没有特定于 eclipse 的内容。

see: svn switch

看: svn switch

I prefer to have separate eclipse projects per branch and also change the project name to something like myProject-24 so when the branch is checked out again down the road, the default project name has some branch identifier on it.

我更喜欢每个分支有单独的 Eclipse 项目,并将项目名称更改为 myProject-24 之类的名称,因此当该分支再次被检出时,默认项目名称上有一些分支标识符。

This also enables you to make changes on a per branch level and do single commits across the branches; even if they're in discreet eclipse projects.

这也使您能够在每个分支级别进行更改并跨分支进行单次提交;即使他们在谨慎的日食项目中。

回答by styssi

The functionality you are looking for can be reached by doing the following

可以通过执行以下操作来实现您正在寻找的功能

  1. Right Click on the folder that should be replaced
  2. Click on "Replace With ..." from the context menu
  3. Click on "Branch ..."
  4. Select the branch you want to take a look at from the dropdown box
  1. 右键单击要替换的文件夹
  2. 从上下文菜单中单击“替换为...”
  3. 点击“分支...”
  4. 从下拉框中选择您要查看的分支

ATTENTION: This is replacing your local changes. It is not possible to reverse this.

注意:这将替换您的本地更改。这是不可能逆转的。

Greetings Tobi

问候托比