2

There are already a few links on how to revert a file in TFS. I don't just want to revert a change but remove an entry from the TFS history.

The "Annotate" option will show who changed what on a line-by-line basis. Supposed the file was deleted and added again (instead of using the "undelete" option). Now "Annotate" will show that the entire file was changed by the person who added. If I use "tf rollback" it will only attempt to roll back changes, not the version history.

This is a large file, and it is very useful for our team to know who changed what. Is this possible?

Community
  • 1
  • 1
Peet Brits
  • 2,911
  • 1
  • 31
  • 47

2 Answers2

1

I think the only way to do it is to rollback both the add and the delete, then remake the changes to the restored version, that should work.

In steps:

  • Rollback Add
  • Check In
  • Rollback Delete
  • Check In
  • Edit file, apply the edits made since deletion.
  • Check In.
DaveShaw
  • 52,123
  • 16
  • 112
  • 141
  • 1
    When I do a rollback to before the delete it still shows the changes as the changes made since the add. – Peet Brits Feb 13 '13 at 14:10
  • 1
    Unless I misunderstood what you meant by "remake the changes" – Peet Brits Feb 13 '13 at 14:11
  • 1
    @PeetBrits - I've added the steps - I'm still not 100% sure this will be what you want, might be worth testing it first, – DaveShaw Feb 13 '13 at 20:37
  • 1
    If there are no changes then rollback reports: "TF204003: No changes to roll back." (So I cannot undo add then undo delete.) – Peet Brits Feb 14 '13 at 06:43
  • 1
    I tried a couple of things and it did not work. I even tried to delete it, check it in, then looked for a way to undelete the first delete, but could not find such a function. – Peet Brits Feb 14 '13 at 06:46
  • And you cannot pend a delete and edit an item simultaneously. (during "rollback add") – Peet Brits Feb 14 '13 at 06:56
1

It cannot be done.

Rollback only reverts file changes, not the file state.

In other words, if you rollback to before the delete and check it in, then "Annotate" will only show changes since the previous change after the add.

Peet Brits
  • 2,911
  • 1
  • 31
  • 47