Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove a specific ChangeSet in TFS 2010?

Tags:

c#

tfs

tfsbuild

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 543 only in tfs?

like image 653
Cherry Avatar asked Dec 26 '13 12:12

Cherry


People also ask

How do I get a specific changeset in TFS?

Find the changeset you want and "Get This Version" to only get the changed files. Manually check out each file for edit in Source Control Explorer to match the changeset.

How do I edit a changeset in TFS?

click the CODE link at the top of the page. you should be in the Explorer tab under your project, in the tree view navigate and select the specific branch you are interested in. click the Changesets link at the top of the page to bring up the changesets for that branch.

How do I delete a checkin in TFS?

Hi, You can do "tfpt rollback" which will pend the necessary changes. If you want the rollback to be committed by a different service/person than the service/person who runs tfpt, have it/them shelve the changes first.


3 Answers

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
like image 191
Arin Ghazarian Avatar answered Sep 27 '22 23:09

Arin Ghazarian


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.

like image 33
Adarsh Shah Avatar answered Sep 27 '22 23:09

Adarsh Shah


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.

like image 35
David Airapetyan Avatar answered Sep 28 '22 00:09

David Airapetyan