我可以在 Subversion 中删除提交吗?

发布于 2024-12-03 22:00:22 字数 130 浏览 1 评论 0原文

每次意外我犯了两次,因为我忘记添加两个文件。我可以从日志中删除特定的提交吗?

日志截图

我想删除第 4 号提交。

Per accident I committed twice because I forgot to add two files. Can I remove a specific commit from the log?

screenshot of log

I want to delete commit № 4.

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

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

发布评论

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

评论(5

无声情话 2024-12-10 22:00:22

简单的答案是“否”,因为 Subversion 不知道如何解决当您添加提交、其他人更新其签出,然后您从历史记录中删除提交时的情况。可能有也可能没有涉及 Subversion 存储手术的复杂答案。

The simple answer is "no", because Subversion doesn't know how to resolve the case when you add a commit, someone else updates their checkout, and then you remove the commit from history. There might or might not be a complex answer involving surgery on the Subversion storage.

兮子 2024-12-10 22:00:22
  1. AFAICS,您不删除 r4,但与 r5 合并,是吗?
  2. 一般来说,SVN 提交历史是不可变的,正如 Sii 所说 - 如果你
    无权删除/创建存储库 - 你无能为力。

如果您可以删除当前的存储库并使用新的历史记录创建新的存储库,您可以尝试:

  • svnadmin dump以获得人类可读的(我不得不说)
    存储库转储、grok 格式和编辑转储、删除存储库、svnadmin load
    重新创建存储库的
  • 另一个想法是(而不是编辑转储)另一个
    SCM,它有一个通往SVN的桥梁(hg+MQ(histedit)+hg-git,fe,将
    允许您获取存储库并折叠/删除变更集)。用于更换
    旧存储库 - 参见上面第 2 页
  1. AFAICS, you have not delete r4, but merge with r5, yes?
  2. In general, SVN commit history is immutable, as Sii said - and if you
    haven't rights delete/create repo - you can't do anything.

If you can delete current repo and create new with new history, you can try:

  • svnadmin dump for getting human-readable (barely, I have to say)
    repository-dump, grok format and edit dump, delete repo, svnadmin load
    to recreate the repo
  • another idea is (instead of editing dump) another
    SCM, which has a bridge to SVN (hg+MQ (histedit)+hg-git, f.e, will
    allow you to get repo and fold/delete changesets). For replacing
    old repository - see p.2 above
阿楠 2024-12-10 22:00:22

在您的情况下,只需修改与提交 #4 关联的提交注释即可反映您所做的实际更改。您可以通过修改 SVN 存储库配置来使用 Subversion 来实现此目的。请参阅 Subversion 常见问题解答

In your case, it's just necessary to modify the commit comment associated with commit #4 to reflect the actual changes you made. You can do that with Subversion by modifying the SVN repository configuration. See the Subversion FAQ.

虚拟世界 2024-12-10 22:00:22

对于任何真正尝试执行此操作并且您对文件系统具有写访问权限的人来说,存储库位于此,如果它是当前的最后一次提交,则此过程有效:

rm [repo root dir]/revprops/###/######
rm [repo root dir]/revs/###/######
vi [repo root dir]/db/current
decrement rev number by 1

其中 ### 是修订版的前几个数字,而 ##### # 是完整的转速。

For anyone actually trying to do this and you have write access to the filesystem the repo is on this is the procedure that works IF it's the current last commit:

rm [repo root dir]/revprops/###/######
rm [repo root dir]/revs/###/######
vi [repo root dir]/db/current
decrement rev number by 1

Where ### is the first few numbers of the revision and ###### is the full rev number.

风吹短裙飘 2024-12-10 22:00:22

为什么?让 Subversion 保留历史——这就是它的目的。尽早且经常入住。无需删除提交 #4。

Why? Let Subversion keep the history - that's what it's for. Check in early and often. There's no need to erase commit #4.

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