简体   繁体   中英

SVN Copy into Working Copy, Can't Un-delete a file (before commit)

I somehow accidentally deleted a file when creating a branch, and I can't figure out how to get it back without losing file history.

What I did

I'm using TortoiseSVN (1.8.2). I copied a branch by doing

right-click, drag, release and select "SVN Copy and rename versioned item here"

I thought that I did nothing else (specifically, I have not committed the new branch in my working copy).

Something must have happened though - it could be pilot error, I'm not sure - but bottom line, a file (NewBranch/app/web/classes/config.properties) didn't show up in the list. Somehow I deleted that file.

When I checked for modifications

right-click, TortoiseSVN -> Check for modifications

the files & folders of the branch appeared with status "normal(+)", with two exceptions:

  • the root folder of the branch (NewBranch) appears with status "added(+)"
  • this config.properties file shows up with status "deleted(+)"

TortoiseSVN showed a red "!" as the status for the parent folder (NewBranch/app/web/classes) and gave the same status for its parent (web) and its parent (app) and the branch root (NewBranch).

Fixing it?

  1. I tried "right-click, Revert" on the file in the "Check for modifications" output window - it gave me an error

    "can't revert without reverting parent".

  2. I tried doing a "Revert" on the parent folder, and its parent, up to the branch root - I don't get an error but the file does not re-appear.

  3. I tried copying the file from the old branch to this folder - it says I'm adding the file!

Arrg.

I'd like to have the file not deleted & preserve its history. I'll copy the file in if I must - but, any ideas?

As long as you did not commit you did not lose much.

As fixing ("reverting") the working copy is causing problems, I would start over with a re-checkout:

Just check out the folder you want to branch and choose TortoiseSVN->branch/tag. choose the branch/ folder and add your branchname. by this it is much easier to create a branch (without creating it in your workingcopy as well).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM