How to remove a specific changeset in tfs2010?
I have changeset version numbers with 545, 544, 543,542.
Now, I am looking to delete the particular changeset
Disclaimer - you should never, never do this. Don't even think about it!
Background - I am trying to do a partial TFS migration, and having the most villainous time with the "TFS Integration" tool. Recently it dumped a series of wrong changesets into my destination TFS. Instead of wiping everything out and starting from scratch, I nosed around the TFS database, and came up with the following (on TFS 2013, TFS 2010 would be more or less similar I suppose):
declare @ChangeSetId int = 5735
-- Delete the actual file content first
delete from tbl_Content where ResourceId in (select ResourceId from tbl_File where FileId in (select FileId from tbl_Version where VersionFrom = @ChangeSetId))
-- Remove the file
delete from tbl_File where FileId in (select FileId from tbl_Version where VersionFrom = @ChangeSetId)
-- Purge the version
delete from tbl_Version where VersionFrom = @ChangeSetId
-- Destroy the changeset
delete from tbl_ChangeSet where ChangeSetId = @ChangeSetId
It is not wise to do it. It is not supported by Microsoft. Do not use it on a live production environment! Use rollback instead! But if you're desperate to wipe out a changeset, you can try this. But don't tell me you were not warned.
You cannot delete a changeset in TFS. Even if you could somehow, (I think you can run a sql query against the TFS database to do that) its not a good practice. If people start deleting changesets/history the whole purpose of version control will be defeated. I think few other source controls allow that but I would not suggest to do that. Its a bad practice.
Also, if you use other features of TFS like Workitems/Test Cases
etc. changesets get linked to it so if they get deleted the links will become orphan(I think).
As Arin said the closest thing you can do is to use Rollback command but when you do that you will have to check-in the code after rollback so basically you will see the old changset and the new one(rollback) in the history.
You have to Rollback the changeset, you can't delete a changeset. (Rollback Command)
In your case a simple Rollback command would be like this:
TF rollback /changeset:C543