简体   繁体   English

是否有任何方法可以将我对SVN结帐的更改提交给分支机构?

[英]Is there any way to commit changes that I've made to my SVN checkout of trunk to a branch instead?

I just started working on some changes against trunk on an SVN repo, thinking they would be somewhat small. 我刚刚开始在SVN回购上对trunk进行一些更改,认为它们会有点小。 Now, I actually am beginning to realize that I probably should have just started a new branch instead. 现在,我实际上开始意识到我可能应该刚开始一个新的分支。 Rather than making a branch, and then moving each individual piece into it, is there any way to make a new branch and then commit the changes in my working copy to it? 而不是制作一个分支,然后将每个单独的部分移入其中,有没有办法建立一个新的分支,然后将我的工作副本中的更改提交给它?

  1. make a new branch from the place where you started developing 从你开始开发的地方建立一个新的分支
  2. switch to the newly created branch 切换到新创建的分支
  3. commit the local changes (will commit to the new branch) 提交本地更改(将提交到新分支)

DO NOT MAKE ANY CHECKOUT 不要做任何结账

I do it with svn 1.6.5, it works without trouble but if you are really paranoid you could do following: 我用svn 1.6.5做它,它没有麻烦但是如果你真的是偏执狂你可以做以下事情:

  1. create a patch from current working copy 从当前工作副本创建补丁
  2. create a branch 创建一个分支
  3. switch to it 切换到它
  4. apply the patch 应用补丁
  5. commit 承诺

如何使用svn diff从当前工作创建补丁,然后创建一个新分支,并使用patch -p0将补丁应用到分支?

You can directly branch the state of your working copy to a URL with the svn copy command. 您可以使用svn copy命令将工作副本的状态直接分支到URL。 The created branch will include the local modifications. 创建的分支将包括本地修改。

Some gotchas: 一些陷阱:

  • you may get errors stating something like "File already exists". 您可能会收到错误,指出“文件已存在”之类的内容。 This is caused by a mismatch of base revisions in your working copy, more specifically between a file and its parent folder. 这是由于工作副本中的基本修订版本不匹配,更具体地说是文件与其父文件夹之间的不一致。 One possible solution is to do a svn update before attempting to branch in this way. 一种可能的解决方案是在尝试以这种方式进行分支之前执行svn update
  • after the svn copy , the working copy will be unchanged. svn copy ,工作副本将保持不变。 It will still point to the trunk. 它仍将指向行李箱。 It will also still show the local modifications in its status. 它还将显示其状态的本地修改。 You should first revert these modifications, whether you continue using the working copy as is or switch it to the new branch. 无论是继续按原样使用工作副本还是将其切换到新分支,都应首先还原这些修改。

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

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