Why you should not DELETE after a MOVE if history is important to you!


What happens when you use the move feature in the Source Control Explorer? Let’s explore in a demo environment, do NOT test this on a production system!
image

Exploration #1 – Let’s do a quick move and see what happens

We create two team projects DemoSource and DemoTarget, both using the TFVC for version control.

  1. We create two team projects DemoSource and DemoTarget, both using the TFVC for version control.

  2. Next we create a Main folder and convert each to a branch.

  3. We should now see something like this:

    image

  4. Add a solution named DemoSolution to the DemoSource team project and create some churn (history).

  5. As shown we now have 5 changesets worth of history in the DemoSource team project:

    image

  6. Next we move the DemoSolution from the DemoSource team project to the DemoTarget team project, using the solution explorer:

    image

  7. Check in the pending change created by the move.

  8. If you check the history on DemoTarget team project you will notice that history from DemoSource is missing, it was NOT moved.
    image 

    Moves (aka renames) are implemented as a branch + delete operation - we branch from the source (i.e. team project) to the target and delete the items from the source. 

    Verify that you are ABSOLUTELY sure, before your delete the DemoSource team project.
    image

  9. As highlighted in the following warning all source control items will be destroyed and we will no longer be able to follow the move operation to the original location. 
    image

    Exploration #2 – When does history vanish?

    • Re-do the exploration #1, but STOP after step 6 and do not check-in the pending move change, which is actually a rename:
      image
    • Looking at the history of the DemoTarget, we notice we see history from the source:
      image
    • Once we commit the pending change, the source evidence disappears.
      image
    • By looking at the changset (39) details, we can still track the move back to the DemoSource.
      image
    • Going to DemoSource we can find the missing history.
      image
    • But … as soon as you delete your source, the changeset (39) details change as we can no longer track the move back to the origin … vanished (deleted)!
      image

    Hope this clarifies the Move using Source Explorer. If you need to move history, you should read Understanding TFS migrations from on-premises to VSO - Part 1 - Concepts and investigate Migration and Integration Solutions.

    Comments (4)

    1. ErikEJ says:

      Assume you mean "Source Control Explorer", not "Solution Explorer" in first sentence?

    2. @ErikEJ – Yes, thank you for spotting that.

    3. Jean-Pierre says:

      Hello Mr Schaub,

      Thanks for this post.  I came across the same problem a few weeks ago!

      Best Wishes

      Jean-Pierre

      🙂

    4. Steve Olner says:

      I have been advocating this to my teams for a while now , nice to see it in print as a reference for standards

    Skip to main content