Editing Undoing-a-commit

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
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 or need to revert a change made by someone else because it breaks functionality. For example:
+
$ svn ci test_vls.c
 +
... revision: 9999
  
$ svn ci test_vls.c
+
We want to "uncommit" the changeBut 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
Sending        test_vls.c
+
First get the URL of the trunk:
  Transmitting file data .
 
Committed revision 9999.
 
  
We want to "uncommit" the change. If we don't want to lose the changes we just committed, no worries. We can copy those file(s) to an unversioned directory '''before''' we do the merge steps below or extract  those changes at any point in the future with the "svn diff" command. Stash the changed file(s) if desired.
+
$ svn info
 +
...https://brlcad.sf.net/brlcad/trunk
  
Do the merge (note the dot):
+
Do the merge:
  
$ svn svn merge -r9999:9998 '''.'''
+
$ svn svn merge -r9999:9998 https://brlcad.sf.net/brlcad/trunk
U  test_vls.c
 
  
 +
Check that the trunk has changed to the state before the bad commit:
  
That just "merged" the commits from revision 9999 to 9998, which effectively "undoes" 9999.  Check that your trunk checkout has changed back to the state before the bad commit:
+
$ svn diff
  
$ svn diff
+
httpshttps://brlcad.svn.sourceforge.net/svnroot/brlcad/brlcad/trunk
...
+
  svn commit -m"undoing bad commit rev 50643"
 
 
Save the diffs if desired.
 
 
 
Commit the change ('''caution''': this will undo local changes that were originally committed!):
 
 
 
  $ svn commit -m "Reverting r9999 because ..."
 
Sending        test_vls.c
 
Transmitting file data .
 
Committed revision 10000.
 

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)