Difference between revisions of "Undoing-a-commit"

(New page: Sometimes one may inadvertently commit a change that was not intended. For example: $ svn ci test_vls.c ... revision: 9999 We want to "uncommit" the change. But if we don't want to los...)
 
(Adding a clear example of backing out an unintentional commit)
Line 1: Line 1:
 +
= Undoing an svn commit =
 +
 
Sometimes one may inadvertently commit a change that was not intended.  For example:
 
Sometimes one may inadvertently commit a change that was not intended.  For example:
  
$ svn ci test_vls.c
+
$ svn ci test_vls.c
... revision: 9999
+
... revision: 9999
 +
 
 +
We want to "uncommit" the change.  But if we don't want to lose the changes we made, we either need to copy the changed file(s) to an unversioned directory or save the differences before we commit the merged changes.
  
We want to "uncommit" the change.  But if we don't want to lose the changes we made, we either need to copy the changed file(s) to an unversioned directory or save the differences before we commit the
+
First get the URL of the trunk (shortened example):
First get the URL of the trunk:
+
  
$ svn info
+
$ svn info
...https://brlcad.sf.net/brlcad/trunk
+
Path: .
 +
URL: https://brlcad/svnroot/trunk
 +
Repository Root: https://brlcad/svnroot
 +
Repository UUID: 2f96ce8b-6d43-0410-b8df-bffccc660ffb
 +
Revision: 9999
 +
Node Kind: directory
 +
Schedule: normal
 +
Last Changed Author: tom
 +
Last Changed Rev: 9999
 +
Last Changed Date: 2012-05-23 15:10:33 -0500 (Wed, 23 May 2012)
  
 
Do the merge:
 
Do the merge:
  
$ svn svn merge -r9999:9998 https://brlcad.sf.net/brlcad/trunk
+
$ svn svn merge -r9999:9998 https://brlcad/svnroot/trunk
  
 
Check that the trunk has changed to the state before the bad commit:
 
Check that the trunk has changed to the state before the bad commit:
  
$ svn diff
+
$ svn diff
 +
...
  
httpshttps://brlcad.svn.sourceforge.net/svnroot/brlcad/brlcad/trunk
+
<to be continued>
svn commit -m"undoing bad commit rev 50643"
+

Revision as of 18:18, 23 May 2012

Undoing an svn commit

Sometimes one may inadvertently commit a change that was not intended. For example:

$ svn ci test_vls.c
... revision: 9999

We want to "uncommit" the change. But if we don't want to lose the changes we made, we either need to copy the changed file(s) to an unversioned directory or save the differences before we commit the merged changes.

First get the URL of the trunk (shortened example):

$ svn info
Path: .
URL: https://brlcad/svnroot/trunk
Repository Root: https://brlcad/svnroot
Repository UUID: 2f96ce8b-6d43-0410-b8df-bffccc660ffb
Revision: 9999
Node Kind: directory
Schedule: normal
Last Changed Author: tom
Last Changed Rev: 9999
Last Changed Date: 2012-05-23 15:10:33 -0500 (Wed, 23 May 2012)

Do the merge:

$ svn svn merge -r9999:9998 https://brlcad/svnroot/trunk

Check that the trunk has changed to the state before the bad commit:

$ svn diff
...

<to be continued>