如何保存 diff 以供以后重用 - 类似于 TFS 中的 shelfset 的功能?

发布于 2024-11-15 22:03:16 字数 193 浏览 2 评论 0原文

我对文件进行了一些更改,但意识到我需要以其他方式修改它 - 这需要我将当前的更改临时保存在其他地方并稍后应用。我如何在 svn/subversion 工具(例如 TortoiseSVN)中执行此操作?

我提到的功能与在 TFS 中制作 shelveset 和取消搁置非常相似。

如果您知道该怎么做,请帮忙。谢谢你!

I make some changes to a file but realize that I need to modify it in other way - this requires me to temporary save my current changes elsewhere and apply it later. How can I do this in svn/subversion tool, e.g. TortoiseSVN?

The feature I'm mentioning is very similar to making shelveset and unshelving it in TFS.

Please help if you know how to. Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

天煞孤星 2024-11-22 22:03:16

AntonyW 的答案有效,但可能有点矫枉过正,特别是如果你有很多代码!

我不熟悉 TFS 的 shelveset 但 svn 为您提供了 svn diff 命令来完成您正在寻找的操作:制作差异并保存它,以便您可以稍后应用。只需获取 svn diff 的输出并将其保存在 .patch 或 .diff 文件中。

svn diff myfile > myfile.patch

由于您使用的是 TortoiseSVN,这更容易做到

AntonyW's answer works, but it might be overkill, especially if you've got a lot of code !

I'm not familiar with TFS' shelveset but svn gives you the svn diff command to do just what you're looking for: making a diff and saving it so you can apply it later. Just take svn diff's output and save it in a .patch or .diff file.

svn diff myfile > myfile.patch

Since you're using TortoiseSVN, this is even easier to do.

烟雨扶苏 2024-11-22 22:03:16

您还可以根据更改创建分支。它甚至可能比将差异存储在磁盘上更好。


编辑:
那么您对工作副本有不同类型的更改吗?
您想要保留的文件和想要保存到 diff 的文件?
在这种情况下,也许从 TortoiseSVN 创建补丁会更好。

但是,如果您想修补工作副本中的所有更改,我认为最好创建分支。
这在 Tortoise 中非常简单:

  1. 创建分支/标签并将工作副本标记为分支源(不检查切换到新分支)。
  2. Tortoise 创建分支后 恢复所有本地更改
  3. 进行另一个更改
  4. 提交到主干
  5. 切换到分支并合并主干中的更改
  6. 将分支重新集成到主干

对于舒尔来说,它在大多数情况下对我有用,补丁适合代码审查,而不适合创建本地工具集未完成的更改;)

You can also create branch with your changes. It could be even better than storing diff on disk.


Edit:
So you have different kind of changes in working copy?
Files that you want to keep and files that you want to save to diff?
In this case maybe creating patch from TortoiseSVN is better.

But if you want to put in patch all changes from working copy it is better in my opinion to create branch.
This is really easy in Tortoise:

  1. Create Branch/Tag and mark Working Copy as source of branch (do not check to switch to new branch).
  2. After Tortoise creates branch revert all local changes
  3. Make your another changes
  4. Commit to trunk
  5. Switch to branch and merge changes from trunk
  6. Reintegrate branch to trunk

For shure it works for me most of the time, patches are good for code review, not for creating local toolset of not finished changes ;)

我最亲爱的 2024-11-22 22:03:16

关于上面给出的答案,我(个人)不同意他们(批量等......)。对于我来说(我也在使用它),这是目前仅由团队基金会支持并且可以跨网络使用的好功能之一。这在以下情况下很有帮助:

  1. 首先也是最突出的是,您可以在主源代码中没有签入(和不完整)代码的情况下获得其他人的审查。
  2. 如果您有多个解决方案,则可以有多个可在应用程序中测试的搁置集。
  3. 如果另一个人在入住之前需要您的某个架子用于部分测试目的,那么它是可用的。

我搜索了这个功能,发现大多数其他产品(SVN、mercurial)将来都会引入这个功能,但目前还没有。

……请求原谅总是比请求许可更好……

Regarding the above answers that are given, I (personally) disagree with them (bulk etc...). As for me (and I am using it as well), this is one of the good features that currently is supported only by team foundation and can be used across a network. This helps a lot in the following situation:

  1. First and most prominent is that you can have a review from another person without having a checked in (and incomplete) code in main source code.
  2. In case you have multiple solutions, you can have multiple shelvesets that you can test in your application.
  3. If another person requires a certain shelveset of yours for partial testing purposes prior to his check in, it's available.

I searched for this feature and found that most of the other products (SVN, mercurial) are going to introduce this feature in the future, but it's not available yet.

...it's always better to ask for forgiveness rather than permission....

撩起发的微风 2024-11-22 22:03:16

我通常会检查一个新位置,在那里进行更改然后提交。

稍后,我对原始位置进行更新,将更改合并到我之前修改的版本中。

I usually do a checkout to a new location, make the changes there then commit.

Later, I do an update on the original location to merge the changes into my previously modified version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文