This project is read-only.

How to undo a check-in

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

To undo the check-in of a file, use the Team Foundation Power Tools (TFPT) rollback command to revert the file to the previous version. The rollback command enables you to roll back an entire changeset at a time, but you can also select individual files from within the changeset to roll back. This is useful if you need to undo a change to a file that was mistakenly checked in, or where you want to undo the check-in because the changes are causing serious integration build issues.

To undo a file check-in and revert to the previous version
  1. Run the following command from a command window that includes the \program files\microsoft team foundation server power tools folder in the path: TFPT rollback filename.cs. Note: If you know the changeset number of the changeset containing the check-in you want to undo, you can supply the changeset number on the command line as follows: TFPT rollback filename.cs /changeset:54
  2. The rollback command needs to ensure that your local workspace is up to date. Click Yes in response to the Roll Back Changeset message. At this point your workspace is updated with files from the server.
  3. If you did not specify a changeset number on the command line, the Find Changeset dialog box is displayed. Enter search criteria, or simply click Find and then locate and select the changeset that contains the check-in you want to undo, and then click Roll Back.
  4. The Roll Back Changeset dialog box is displayed .Because the changeset might contain multiple check-ins, you should select the file for which you want to undo the check-in and then click Roll Back.
Note: If you specified the filename on the command line, only this file in the changeset will be selected.

When undoing check-ins by using the TFPT rollback command, you should be aware of the following:
  • Workspace location – TFPT locates workspaces as follows: If you specify a file path as an argument to filter the rollback, the file paths are used to find the workspace. If you do not specify file paths, the local directory is used to identify the workspace, if the local directory is mapped. The simplest approach to ensure that the tool locates the right workspace is to run the command from a locally mapped directory.
  • Pending changes – You cannot roll back a changeset that contains pending changes. If you attempt to do so, the tool reports an error. In this instance, you must move pending changes to a shelveset and then undo or check in all pending changes before running the rollback command.
  • Merge scenarios – If you are undoing the check-in of a file that has very recently been checked in, you probably will not need to merge changes because it is unlikely that anyone else will have updated the item in the intervening period. However, if you want to undo a check-in, and the check-in to be undone is not the latest change to a file, a three-way merge is required. The current version on the server, the version you have in your workspace, and the version you want to roll back to must be merged together. If there are no conflicts, the changes from the version to be rolled back are extracted from the file, and any changes that came after that version are preserved.
  • Resolving conflicts – If you do need to perform a merge, the merge window is displayed. To resolve the merge, select the item and then click Merge. An automatic merge is initially attempted; if it fails, the merge tool is invoked to resolve the merge. The Auto-Merge All button attempts to automatically merge each of the items in the merge list, but does not attempt to invoke the merge tool.

Additional Resources

Last edited Jul 31, 2007 at 2:53 PM by prashantbansode, version 9


No comments yet.