Can I delete a commit in Subversion?

半腔热情 提交于 2019-11-30 02:04:02

问题


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

I want to delete commit № 4.


回答1:


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.




回答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



回答3:


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.




回答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.



来源:https://stackoverflow.com/questions/7371589/can-i-delete-a-commit-in-subversion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!