Jump to content

Undo changes to a hidden changes item from CLI


Recommended Posts

Hi there,

I'm trying to undo changes from CLI to a changed file that is configured to be a hidden changes item. Doing it from the GUI is very simple and quick.

Not able to do it with 'cm unco'?

Is 'cm update' the right way to go? Was able to get that working but it felt slower than doing it from the GUI.

Link to post
Share on other sites

Hi!

The cm unco command undoes a checked out file even if it is inside the hidden changes item list. As it doesn't seem to work for you, I'll guess that you have modified your file locally, but you have NOT checked it out (which is OK! let's solve it)

You can see the status of locally changed but hidden files with the --hiddenchanged flag fo the status command. Then, once you know which files are you interested in, you can do both a checkout and an undo checkout, which will revert your local changes. The full cycle:

1) --hiddenchanged allows you to see locally modified files if they are not checked out (requires a disk search)

$ cm status --hiddenchanged
cs:32@rep:myrepo@repserver localhost:8087

Modified items (CH = changed, CO = checkout, CP = copied (new), RP = replaced)
 CH MyHiddenChangedFile.cs

 

2) checkout allows you to check out that file. Notice the lack of the --hiddenchanged argument the second time I call cm status, as it is no longer needed.

$ cm checkout MyHiddenChangedFile.cs
The selected items are about to be checked out. Please wait...
Item C:\Users\sluisp\repos\tests\MyHiddenChangedFile.cs was correctly checked out

$ cm status
cs:32@rep:myrepo@repserver localhost:8087

Modified items (CH = changed, CO = checkout, CP = copied (new), RP = replaced)
 CO MyHiddenChangedFile.cs

 

3) undocheckout allows you to undo the checkout on that file, which will also revert its changes:

$ cm undocheckout MyHiddenChangedFile.cs
C:\Users\sluisp\repos\tests\MyHiddenChangedFile.cs unchecked out correctly

$ cm status
cs:32@rep:myrepo@repserver localhost:8087

$ cm status --hiddenchanged
cs:32@rep:myrepo@repserver localhost:8087

 

Please let me know if this solved your issue :)

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...