Как отменить коммит в svn
By far the easiest way to revert the changes from one or more revisions, is to use the revision log dialog.
Select the file or folder in which you need to revert the changes. If you want to revert all changes, this should be the top level folder.
Select TortoiseSVN → Show Log to display a list of revisions. You may need to use Show All or Next 100 to show the revision(s) you are interested in.
Select the revision you wish to revert. If you want to undo a range of revisions, select the first one and hold the Shift key while selecting the last one. If you want to pick out individual revisions and ranges, use the Ctrl key while selecting revisions. Right click on the selected revision(s), then select Context Menu → Revert changes from this revision .
Or if you want to make an earlier revision the new HEAD revision, right click on the selected revision, then select Context Menu → Revert to this revision . This will discard all changes after the selected revision.
You have reverted the changes within your working copy. Check the results, then commit the changes.
Use the merge dialog
If you want to enter revision numbers as a list, you can use the Merge dialog. The previous method uses merging behind the scenes; this method uses it explicitly.
In your working copy select TortoiseSVN → Merge .
In the Merge Type dialog select Merge a range of revisions .
In the From: field enter the full repository URL of your working copy folder. This should come up as the default URL.
In the Revision range to merge field enter the list of revisions to roll back (or use the log dialog to select them as described above).
Make sure the Reverse merge checkbox is checked.
In the Merge options dialog accept the defaults.
Click Merge to complete the merge.
You have reverted the changes within your working copy. Check that the results are as expected, then commit the changes.
Use svndumpfilter
Since TortoiseSVN never loses data, your “ rolled back ” revisions still exist as intermediate revisions in the repository. Only the HEAD revision was changed to a previous state. If you want to make revisions disappear completely from your repository, erasing all trace that they ever existed, you have to use more extreme measures. Unless there is a really good reason to do this, it is not recommended . One possible reason would be that someone committed a confidential document to a public repository.
The only way to remove data from the repository is to use the Subversion command line tool svnadmin . You can find a description of how this works in the Repository Maintenance .
Philip Steiner
Crap. My last commit in Subversion broke Jenkins. How do I undo it?
Sometimes TortoiseSVN gives us too much of a good thing. There are several options with similar names for «reverting» and «updating» files in Subversion, and I can never keep them straight, thus another post that tries to sum up the options and their effects.
First, just a simple «undo»:
- Right-Click -> TortoiseSVN -> Show log
- Find the revision/changeset you want to rollback to (i.e. the revision just before the change you want to remove)
- Right-click on the single file in the list of files -> Revert to this Revision
- Right-Click -> TortoiseSVN -> Show log.
- Find the revision/changeset you want to rollback to
- Right-click on that revision -> Revert to this Revision
(Paraphrased from eduncan911’s lucid instructions in this post on Stack Overflow)
Wait a minute. The context menu in TortoiseSVN (1.9.7.x) shows three similar commands when selecting a revision in the list:
- Update item to revision
- Revert to this revision
- Revert changes from this revision
and just the last one, «Revert changes from this revision,» when selecting an item in the list of files.
Svn. Откат изменений на сервере
Бывает накомитешь какашек — потом жалеешь. Вот пилюля для отката изменений на сервере:
svn diff -r 73:68 http://my.repository.com/my/project/trunk
73 — наша текущая ревизия
68 — куда хотим откатиться
Смотрим дейстивтельно ли только мы вносили изменения файл. Если нет, то придется откатыватся вручную — через редактирования проблемных участков с последующим комитом. Если все ок:
svn merge —dry-run -r 73:68 http://my.repository.com/my/project/trunk/
Смотрим что будет мержиться, если нет никаких конфликтов идем дальше:
svn merge -r 73:68 http://my.repository.com/my/project/trunk/
svn merge просматривает измениния между 73 и 68 ревизией и применяет их к вашей рабочей копии
IgorKa — Информационный ресурс
Немного обо всем и все о немногом, или практический опыт системного администратора.

| Пн | Вт | Ср | Чт | Пт | Сб | Вс |
|---|---|---|---|---|---|---|
| « Янв | Март » | |||||
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | |||
Отменить последний коммит в SVN
3 февраля 2013, 17:15
Иногда, возникает ситуация когда нужно отменить последний коммит в SVN. Причины могут быть разные. Например, бывает, что разработчик работает с несколькими ветками и по ошибке делает svn commit не в ту ветку. В этом случае нужно вернуть код на момент предпоследнего коммита. Если говорить более правильно, то отменить коммит нельзя. Здесь под операцией отмены подразумевается еще одна операция svn commit, которая отменит изменения последнего коммита.
И это можно сделать всего двумя командами: svn merge и собственно svn commit.
Допустим, что последняя ревизия 44 ошибочна и нам нужно вернуть содержимое SVN на сервере до 43 ревизии.
Если коротко, то нужно всего-навсего выполнить вот такую команду merge (команда должна быть выполнена из корневого каталога рабочей копии.):
-44 — это номер последней ошибочной ревизии со знаком минус.
А затем выполнить svn commit:
Теперь чуть подробнее и с примерами. С операцией svn merge я более менее знаком хорошо, а вот то, что параметр -с может принимать отрицательные значения я узнал недавно. И в этом минусе и содержится весь “фокус”. Хотя все логично.
Если выполнить команду svn merge с параметром –dry-run, то мы увидим какие файлы будут изменены:
Как видим ничего изменено не будет, так как рабочая копия (файлы на нашем локальном компьютере) и копия на сервере SVN одинаковы.
А вот если выполним команду вот так (с минусом):
то увидим, что два файла будут изменены и будет выполнен Reverse-merging ревизии 44 в нашу рабочую копию.
Команда svn diff покажет что будет изменено:
Можем видеть, что из обеих фалов будет удалена строка New Text, которая и была добавлена в 44-й ревизии. И наша рабочая копия будет соответствовать ревизии 43. И эту версию рабочей копии мы и отправим на сервер (это будет ревизия 45), которая будет такой же как и ревизия 43.
Итак, пробуем. В рабочей копии сейчас находится последняя ошибочная ревизия — 44. Вот содержимое файлов:
Выполняем команду svn merge:
Проверяем рабочую копию:
Смотрим содержимое файлов:
Теперь можно отправлять текущую версию рабочей копии на сервер:
Чтобы убедится, что ревизия 45 точно такая же как и 43-я выполним команду:
Разницы нет. А это значит, что мы “отменили” последний неверный коммит (44-й).