简体   繁体   中英

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)

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%

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