How “Get Latest Version” Really Works in TFS Source Control?

13 באפריל 2009

3 תגובות

Many people using the Source Control of the Team System don’t really understand how do Get Latest Version works.


Customers calls me in the middle of the night telling me that they have lost files and lost changes, after the shuck is over I ask them what they did, they tell me: “I did Get Latest Version and I don’t see the files or the changes”.


Because that I am tired of getting to customers in the middle of the night I decided to write this post explaining how does it work.


Lets start with that the Get Latest Version is not overwriting local changes, so if you have deleted a file than the system sees it as an intention of making a change with the file, at that case deleting the file from the project. So at that case when doing Get Latest Version you will not get the deleted file.


Get Latest Version works in a check list method, means that when it gets a file from the server to your local file system it writes down the file and its version, it will not get that file again until the file version will be changed on the server.


In case you made local changes and changes have been made on the server the Get Latest Version will trigger the merge window in order to merge your local changes with the server changes.


Here are some examples:


Scenario 1: 


You trigger a Get Latest Version and get all the files from the server, one of the files is test.txt and its version on the server is V5.
You check out the test.txt, open it and add your name to it.
You save the file but you don’t check in the file.
You trigger the Get Latest Version once again.
A check is being made in the check list and the source control finds that the server has V5 for test.txt and on the last Get Latest Version you got V5 so nothing happens to this file.
You check your local changes and you can still see them.


Scenario 2: 


You trigger a Get Latest Version and get all the files from the server, one of the files is test.txt and its version on the server is V5.
You delete the file.
you don’t check in the deletion.
You trigger the Get Latest Version once again.
A check is being made in the check list and the source control finds that the server has V5 for Test.txt and on the last Get Latest Version you got V5 so nothing happens to this file.
You check your local file system and you find that the file is missing.


Scenario 3: 


You trigger a Get Latest Version and get all the files from the server, one of the files is test.txt and its version on the server is V5.
You check out the test.txt, open it and add your name to it.
You save the file but you don’t check in the file.
You trigger the Get Latest Version once again.
A check is being made in the check list and the source control finds that the server has V6 for test.txt and on the last Get Latest Version you got V5.
The source control also see that your local version contains changes, so it triggers the merge tool.


So we can see the most common scenarios that can happen with the Get Latest Version, I hope that now its mechanism is clear and there will be less night work for me ;-)


Have Fun!!!

הוסף תגובה
facebook linkedin twitter email

כתיבת תגובה

האימייל לא יוצג באתר. (*) שדות חובה מסומנים

3 תגובות

  1. ron26 באוגוסט 2009 ב 0:03

    How about this scenario: I get V4 from server, make a local change, and later undo pending changes. say there's V5 on the server. I get latest and what I see is I don't get V5.

    להגיב
  2. Eran Ruso26 באוגוסט 2009 ב 11:22

    Ron,

    This is impossible, it must be a mistake.
    Make sure the server has a newer version than what you have on your computer.
    In case the server has a newer version he will let you know even if you have changes, what you will need to do is merge in that case.
    In the scenario that you are describing the sever will get the latest version.

    להגיב
  3. Michael3 בפברואר 2010 ב 15:09

    How about this scenario that happens on my machine once a month! I get latest version and ALL files on my machine except the solution and project files get automatically deleted from the disk!

    The only way to fix it is to totally delete the solution from the workspace and download it again.

    להגיב