Ashwinee K Jha
Ashwinee K Jha

Reputation: 9307

Update to a specific revision of a branch

I want to get the code as it was in a specific revision of an earlier branch. My working copy is switched to another branch right now. Note I want to only do this for specific directory.

My svn version is svn, version 1.6.17 (r1128011)

Upvotes: 1

Views: 1065

Answers (1)

Sirs
Sirs

Reputation: 1297

Let's say you're in ORIGINATING_BRANCH and the version of the file you're interested in is in TARGET_BRANCH

I'd do it like this:

svn switch https://%REPO%/branches/%TARGET_BRANCH%/%DIR%/%FILE% -r %VERSION% %FILE%

If you want to commit it back into your initial branch, you'll need to switch back:

svn switch https://%REPO%/branches/%ORIGINATING_BRANCH%/%DIR%/%FILE% %FILE%
svn commit %FILE% -m "%MESSAGE%"

Be careful: on the second switch you'll need to merge both versions (the old one with your newer modifications, and the other), so you better save a backup copy of your changes before switching back.

If you want to use svn merge simply do something like:

svn merge https://%REPO%/branches/%TARGET_BRANCH%/%DIR%/%FILE%@version https://%REPO%/branches/%ORIGINATING_BRANCH%/%DIR%/%FILE%

Upvotes: 4

Related Questions