Undo changes
Undo local changes in your repository.
Read time 3 minutesLast updated 7 days ago
To undo pending changes, use the Unity Devops Version Control application or the CLI. For more flexibility and specificity with the way that you undo changes, use the CLI.
Undo changes in the GUI
You can undo changes in the Pending Changes tab of the UVCS desktop application:- Select the files that you want to undo.
- Add a comment and select Undo.
- Select Undo.
- Undo unchanged: this option removes any files that you have checked out but not changed. You can also use this option to remove unchanged files from the list of pending changes.
- Undo checkouts keeping changes: this option allows you to remove the checkout on a file but keep the changes in your pending changes.
Undo changes in the CLI
Undo all changes in a workspace
You can delete all of your pending changes and start from your original workspace. To remove your pending changes, use thecm undo -r-rcm undo -r
Filter the undo
By default, the undoundoYou can use the following filters to undo the addition and deletion of files but keep the changes in the modified files:>cm status /main/fix-1342@quake@localhost:8084 (cs:575 - head) Changed Status Size Last Modified Path Changed 49.23 KB 2 hours ago code\bsp-renamed.c Changed 23.42 KB 2 hours ago code\cgame\cg_drawtools.c Changed 61.23 KB 9 minutes ago libs\cmdlib.h Changed 398 bytes 8 minutes ago libs\str.h Deleted Status Size Path Removed 12.41 KB code\bsp-temp.c Added Status Size Last Modified Path Added 4.42 KB 17 seconds ago code\bsp-experimental.c
The filtered undo leaves you with the following status:>cm undo --added --deleted -r c:\Users\pablo\wkspaces\quake_path\code\bsp-experimental.c unchecked out correctly c:\Users\pablo\wkspaces\quake_path\code\bsp-temp.c unchecked out correctly
>cm status /main/fix-1342@quake@localhost:8084 (cs:575 - head) Changed Status Size Last Modified Path Changed 49.23 KB 2 hours ago code\bsp-renamed.c Changed 23.42 KB 2 hours ago code\cgame\cg_drawtools.c Changed 61.23 KB 10 minutes ago libs\cmdlib.h Changed 398 bytes 9 minutes ago libs\str.h
Undo a single change
To undo a single change, you run theundo
For example, you might have the following changes:
To undo only the changes to>cm status /main/fix-1342@quake@localhost:8084 (cs:575 - head) Changed Status Size Last Modified Path Changed 15.83 KB 50 seconds ago code\cgame\cg_ents.c Changed 35.27 KB 30 seconds ago code\cgame\cg_main.c
cg_main.c>cm undo code\cgame\cg_main.c c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_main.c unchecked out correctly >cm status /main/fix-1342@quake@localhost:8084 (cs:575 - head) Changed Status Size Last Modified Path Changed 15.83 KB 50 seconds ago code\cgame\cg_ents.c
Undo changes on specific paths
To undo changes only under a specific path, use thecm undoThe following command undoes the changes in the>cm status /main/fix-1342@quake@localhost:8084 (cs:575 - head) Changed Status Size Last Modified Path Changed 15.83 KB 50 seconds ago code\lib\be_aas_cluster.c Changed 35.27 KB 5 minutes ago code\cgame\cg_ents.c Changed 73.15 KB 5 minutes ago code\cgame\cg_localents.c Changed 62.62 KB 5 minutes ago code\renderer\tr_cmds.c Changed 12.26 KB 5 minutes ago merge\Socket.cs
codemerge>cm unco code -r c:\Users\pablo\wkspaces\quake_path\code\renderer\tr_cmds.c unchecked out correctly c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_localents.c unchecked out correctly c:\Users\pablo\wkspaces\quake_path\code\cgame\cg_ents.c unchecked out correctly c:\Users\pablo\wkspaces\quake_path\code\lib\be_aas_cluster.c unchecked out correctly >cm status /main/fix-1342@quake@localhost:8084 (cs:575 - head) Changed Status Size Last Modified Path Changed 12.26 KB 5 minutes ago merge\Socket.cs