You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Bo Berglund <bo...@gmail.com> on 2020/10/22 14:21:44 UTC

How to revert trunk to an earlier revision?

When I look up svn revert it only talks about removing local edits,
but what about this:

Working on trunk and committing a few changes, which later turns out
to be wrong.
Now I want to set trunk head to be at the revision where the edits
started out from.
If I update my wc to that rev I get the state I want but now I cann
not commit anymore...

So how is this done? (I assume it is possible and if done via svn it
should also be reversible).


-- 
Bo Berglund
Developer in Sweden


Re: How to revert trunk to an earlier revision?

Posted by Bo Berglund <bo...@gmail.com>.
On Thu, 22 Oct 2020 14:25:25 -0400, Nathan Hartman
<ha...@gmail.com> wrote:

>On Thu, Oct 22, 2020 at 10:25 AM Bo Berglund <bo...@gmail.com> wrote:
>> If I update my wc to that rev I get the state I want but now I cann
>> not commit anymore...
>>
>> So how is this done? (I assume it is possible and if done via svn it
>> should also be reversible).
>
>It is reversible in the sense that no information is ever lost or
>removed from the repository.
>
>Suppose you're at revision 515 and to use Thorsten's example you want
>to "go back" to revision 497, after running:
>
>svn merge -r HEAD:497 .
>
>(followed by commit)
>
>revisions 498 through 515 are still in the repository and you can
>always access them later.
>
>See "Undoing Changes" in Chapter 4 of the Subversion Book:
>
>http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo
>
>Nathan

Thanks!


-- 
Bo Berglund
Developer in Sweden


Re: How to revert trunk to an earlier revision?

Posted by Nathan Hartman <ha...@gmail.com>.
On Thu, Oct 22, 2020 at 10:25 AM Bo Berglund <bo...@gmail.com> wrote:
> If I update my wc to that rev I get the state I want but now I cann
> not commit anymore...
>
> So how is this done? (I assume it is possible and if done via svn it
> should also be reversible).

It is reversible in the sense that no information is ever lost or
removed from the repository.

Suppose you're at revision 515 and to use Thorsten's example you want
to "go back" to revision 497, after running:

svn merge -r HEAD:497 .

(followed by commit)

revisions 498 through 515 are still in the repository and you can
always access them later.

See "Undoing Changes" in Chapter 4 of the Subversion Book:

http://svnbook.red-bean.com/nightly/en/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo

Nathan

Re: How to revert trunk to an earlier revision?

Posted by Thorsten <tg...@freigmbh.de>.
Hello,

> When I look up svn revert it only talks about removing local edits,
> but what about this:
>
> Working on trunk and committing a few changes, which later turns out
> to be wrong.
> Now I want to set trunk head to be at the revision where the edits
> started out from.


You can use a feature called reverse merge.

First make sure your working copy has no pending changes. -> revert 
everything or check out a new copy

If you want to go back to revision 497 use:

|svn merge -r HEAD:497 .|

you can now commit to " sort of reset" the server to the same code as in 
version 497, or make more edits before you commit.

https://stackoverflow.com/questions/1930725/svn-reverse-merge