Re: Trying to restore a deleted directory in svn

Nathan Hartman <[email protected]> Sat, 31 Jan 2026 00:25:06 -0500
Newsgroups gmane.comp.version-control.subversion.user
Message-ID <CAJT2EHojqv3uNAqqqShBi6R57UyJR88k5=AEbbAqc+LOH0yTDw@mail.gmail.com>
--000000000000b566d40649a85071
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Fri, Jan 30, 2026 at 9:12=E2=80=AFPM Sunil Matta <[email protected]>=
 wrote:

> svn: version 1.14.5 (r1922182)
> OS: Linux Fedora 42
>
> I had deleted a directory in svn using svn del <working directory>
> followed by a commit on that delete.
>
> svn committed the delete, giving me a revision number.
>
> The files are still on my working directory but an svn list of the
> file:///home/svn-repo/__project_path__/trunk shows empty.
>
>
> Trying to revert using the svn path,
> svn revert file:///home/svn-repo/__project_path__/trunk
> doesn't work.
>

>
> Looked in the svn red bean book, couldn't finding anything on undoing a
> delete post commit.
>
> Is it possible to undelete those files in svn? i.e Is it possible to
> revert to the state of directory prior to the delete revision number?
>


Yes, it is possible! All information that has been committed to the
repository can be accessed again, and any changes made to that information,
including deletion, can be reversed.

It sounds like you were looking for the answer in the "Basic Usage" chapter
of the red bean book. That section explains 'svn revert', and it would seem
the most logical place to look!

However, 'svn revert' only reverts working copy changes that haven't been
committed yet.

Since the deletion has been committed, what you need are the sections on
Undoing Changes and (the one right after it) Resurrecting Deleted Items:

https://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.b=
ranchmerge.basicmerging.undo

https://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.b=
ranchmerge.basicmerging.resurrect

Perhaps somewhat confusingly, these are not in the Basic Usage chapter, but
rather are located two chapters later in Branching and Merging. This is
because Subversion tries to keep the number of subcommands to a minimum,
and to utilize the same subcommands for multiple different purposes, and so
the same commands used for branching and merging can be used for bringing
back older revisions of files and directories.

Those two sections of the book will explain that you can restore your
deleted files in one of two ways:

- One way is to use 'svn merge' with the '-c' ('--change') option with a
negated revision number, to take the changes in that revision and apply
them in reverse to your working copy; since the change was to delete files,
applying it in reverse will restore those files. You'll have to verify the
outcome in your working copy is what you want and, if so, commit that in a
separate step.

- Another way is to use the 'svn copy' command to copy the deleted files
from the last revision where they existed, into your working copy. Again,
you'll have to verify the outcome and commit in a separate step.

I suggest to read those two sections and see which way is better in this
scenario. (It depends largely on whether there were other changes in that
revision that you don't want to undo.)

Hope this helps. Feel free to ask for more help if you need it...

Nathan

--000000000000b566d40649a85071
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div><div><div><div><div><div>On Fri, Jan 30, 2026 at 9:12=E2=80=AFPM Sunil=
 Matta &lt;<a href=3D"mailto:[email protected]" target=3D"_blank">sellp=
[email protected]</a>&gt; wrote:<br></div><div><div class=3D"gmail_quote"><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb=
(204,204,204)"><div dir=3D"ltr">svn: version 1.14.5 (r1922182)<br>OS: Linux=
 Fedora 42<br><br>I had deleted a directory in svn using svn del &lt;workin=
g directory&gt;<br>followed by a commit on that delete.<br><br>svn committe=
d the delete, giving me a revision number.<br><br>The files are still on my=
 working directory but an svn list of the<br>file:///home/svn-repo/__projec=
t_path__/trunk shows empty. <br><br><br>Trying to revert using the svn path=
,<br>svn revert file:///home/svn-repo/__project_path__/trunk <br>doesn&#39;=
t work.</div></blockquote><blockquote class=3D"gmail_quote" style=3D"margin=
:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-le=
ft:1ex;border-left-color:rgb(204,204,204)"><div dir=3D"ltr"><br><br>Looked =
in the svn red bean book, couldn&#39;t finding anything on undoing a<br>del=
ete post commit.<br><br>Is it possible to undelete those files in svn? i.e =
Is it possible to<br>revert to the state of directory prior to the delete r=
evision number?<br></div>
</blockquote></div></div><div dir=3D"auto"><br></div></div><div dir=3D"auto=
"><br></div></div></div></div></div><div><div><div><div><div><div dir=3D"au=
to">Yes, it is possible! All information that has been committed to the rep=
ository can be accessed again, and any changes made to that information, in=
cluding deletion, can be reversed.</div><div dir=3D"auto"><br></div><div di=
r=3D"auto"><span style=3D"border-color:rgb(0,0,0)">It sounds like you were =
looking for the answer in the &quot;Basic Usage&quot; chapter of the red be=
an book. That section explains &#39;svn revert&#39;, and it would seem the =
most logical place to look!</span><br></div><div dir=3D"auto"><span style=
=3D"border-color:rgb(0,0,0)"><br></span></div><div dir=3D"auto"><span style=
=3D"border-color:rgb(0,0,0)">However, &#39;svn revert&#39; only reverts wor=
king copy changes that haven&#39;t been committed yet.</span></div><div dir=
=3D"auto"><span style=3D"border-color:rgb(0,0,0)"><br></span></div><div dir=
=3D"auto"><span style=3D"border-color:rgb(0,0,0)">Since the deletion has be=
en committed, what you need are the sections on Undoing Changes and (the on=
e right after it) Resurrecting Deleted Items:</span></div><div dir=3D"auto"=
><span style=3D"border-color:rgb(0,0,0)"><br></span></div><div dir=3D"auto"=
><span style=3D"border-color:rgb(0,0,0)"><div dir=3D"auto"><div><a href=3D"=
https://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.b=
ranchmerge.basicmerging.undo" target=3D"_blank">https://svnbook.red-bean.co=
m/en/1.7/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.und=
o</a></div></div><div dir=3D"auto"><br></div><div dir=3D"auto"><div dir=3D"=
auto"><a href=3D"https://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicm=
erging.html#svn.branchmerge.basicmerging.resurrect" target=3D"_blank">https=
://svnbook.red-bean.com/en/1.7/svn.branchmerge.basicmerging.html#svn.branch=
merge.basicmerging.resurrect</a></div></div></span></div><div dir=3D"auto">=
<span style=3D"border-color:rgb(0,0,0)"><br></span></div><div dir=3D"auto">=
Perhaps somewhat confusingly, these are not in the Basic Usage chapter, but=
 rather are located two chapters later in Branching and Merging. This is be=
cause Subversion tries to keep the number of subcommands to a minimum, and =
to utilize the same subcommands for multiple different purposes, and so the=
 same commands used for branching and merging can be used for bringing back=
 older revisions of files and directories.</div><div dir=3D"auto"><br></div=
><div dir=3D"auto">Those two sections of the book will explain that you can=
 restore your deleted files in one of two ways:</div><div dir=3D"auto"><br>=
</div><div dir=3D"auto">- One way is to use &#39;svn merge&#39; with the &#=
39;-c&#39; (&#39;--change&#39;) option with a negated revision number, to t=
ake the changes in that revision and apply them in reverse to your working =
copy; since the change was to delete files, applying it in reverse will res=
tore those files. You&#39;ll have to verify the outcome in your working cop=
y is what you want and, if so, commit that in a separate step.</div><div di=
r=3D"auto"><br></div><div dir=3D"auto">- Another way is to use the &#39;svn=
 copy&#39; command to copy the deleted files from the last revision where t=
hey existed, into your working copy. Again, you&#39;ll have to verify the o=
utcome and commit in a separate step.</div><div dir=3D"auto"><br></div><div=
 dir=3D"auto">I suggest to read those two sections and see which way is bet=
ter in this scenario. (It depends largely on whether there were other chang=
es in that revision that you don&#39;t want to undo.)</div><div dir=3D"auto=
"><br></div><div dir=3D"auto">Hope this helps. Feel free to ask for more he=
lp if you need it...</div><div dir=3D"auto"><br></div><div dir=3D"auto">Nat=
han</div><div dir=3D"auto"><br></div>
</div>
</div>
</div>
</div>
</div>

--000000000000b566d40649a85071--