How can I tell what will be updated if I use "Get Latest Version"? - visual-studio

I have a Visual Studio solution and am using TFS for version control.
When I've made a bunch of changes to my working copy of the solution, the Team Explorer window will show me all the files that I've changed, and allow me to compare my version with either the workspace (original) version, or the latest version in TFS.
However, before I check in my changes, I first want to integrate any changes that have been made (by other people) to the latest TFS version since I got the source from TFS.
I could do a Get Latest Version and hope for the best. However, I would generally prefer to know what will be changed, and have the opportunity to look in detail at those changes, before overwriting my local files.
Is there a way to either compare my workspace (original) version against the latest version in TFS, or to see what the effects of a "Get" will be before I actually execute it?
To be useful, this would have to be a at a solution level - I would not want to have to go through each individual file.

Use Compare... and select Latest Version. That's best executed from the commandline or the Source Control Explorer.
If you compare "Latest Version" (remote) with "Workspace version" (local), then it'll tell you what has changes on the server since the last get-latest.
If you compare "Latest version (remote) with "Latest version" (local), then it'll tell you what has changed both locally and remotely.

The command line is your friend you can use the /preview switch to see what will happen if you do the get
tf get $/MyTeamProject/MySourcePath /recursive /preview

Related

How do I resolve a merge conflict when both server and local versions are wrong?

I am working in the enterprise on Visual Studio 2013 and Team Foundation Server. We have a test source and a production source, and I Get Latest on them both regularly. As there are only a few developers, we make changes directly in test, we don't have personal branches off of test (though when our shop was bigger, we did).
So I opened a file in Test, made a simple change to it, saved it, checked it into test, and published it to production. When I went to merge Test with production, I spawned a merge conflict. I am looking at the "server" version and the "local" version and neither one is correct. The "server" version is the file I edited, minus the edit I just made. That makes sense. But the "local" version is something I haven't seen before, what looks like perhaps an older version that I've never never worked on. Maybe this was my local copy and Get Latest didn't update it. But the local file I edited was exactly what I expected it to be.
So, what could cause that? How do I troubleshoot this problem? All I want is to get the correct version in TFS so it doesn't get blown away later, but I have no idea how to proceed.
This may due to when you do the get latest option, TFS didn't update the workspace correctly.
A clean way to do this, back up your file with changes, undo your pending changes. Delete the old workspace, create a new one. Get latest version from server for both test and production source.
Edit the specific file with changes, check it into the test, and finally do the merge Test with production again.

Issue with rolling back a changeset in TFS 2010

My goal is to have the "latest version" of my code be that of an existing changeset. I choose Roll Back, and roll back to that specific changeset, but my code doesn't change to reflect the changeset's code. Additionally, I tried "Get Specific Version" for that particular changeset, and while my local code changes to the changeset's code, the column in TFS that says "Latest" shows "No" for those files that were reverted - see screenshot below. The screenshot below is a result of "Get Specific Version":
QUESTION: What's the difference between "Get Specific Version" and "Roll Back"? If my goal is to essentially change my current code base to the code base from an existing changeset, and have that as the "latest version" (for TFS reasons - I'm trying to deploy out to our web server using TFS, but since TFS "doesn't have the latest version" - see screenshot above, it uses the current, latest version which is not what I want it to use - I want it to deploy from the code base for the previous changeset), how can I do that?
If you "Get Specific Version" you are changing your local workspace version to that of a previous version on the server. This does not affect the latest version on the server. (You could, of course, check out that path and check it in, which would affect the latest version on the server.)
If you "Roll Back" you are changing the server version. Depending on how you perform this action, you may not be changing your local workspace version. If you do a "Get Latest Version", you will sync up to that latest version.
If you simply want to build/deploy an older version of the code the default build templates allow you to specify a changeset number (or date) and force it to use an older version of the code.
If you really do need to change the "current" code in TFS, then you can do rollback. But it sounds like your understanding of Rollback is incorrect. It's not "rollback to this changeset", rather it's "rollback the changes contained in this changeset".
So if your latest version is v9 and you want to go back to v5, you need to rollback changesets v6-9. You can highlight all 4 of these changesets and roll them back all in one operation. Then check-in.
This will give a better experience than trying to do a get on an older version then check-out/check-in. The history will more accurately reflect what you did, and the conflict resolution dialog won't try and do the wrong thing (as it would if you did a get then check-in/out).

TFS Specific Changeset files to be merged with latest version

I am in the following situation:
A Team Member worked on a task which was partially done in few changesets, few months back. These changesets were reverted and many more changes are done on same files in subsequent changesets.
I want to get the latest version of code (which I have taken) and have some option to get the older changesets (even I can merge changesets one by one) and merge it.
Though I find option to changeset GetThisVersion which gives me whole old codebase. I don't find relevant option in Visual Studio 2010. It would be great to have GUI option and not command line one.
Please help. Thanks in advance.
You can get specific version of a file from file history (view or get specific version) or with command line Need command to get a file from TFS without a workspace. But to get a folder (project, solution) state seems to be necessary to have a workspace How to get specific version of folder from tfs without creating a workspace?. I don't think that there is a possibility to merge an old and newer version. When I want to resuscitate some old code I use view in history and copy/paste.

TFS get latest version with new files

I'm having problems with TFS when adding new files or folders to my solution.
When any other people in the team try to "get latest" it updates every changed file but it doesn't download the new added files!!
If we go to the Source Control explorer, the new files appear as "not downloaded"... and if we force it to download, then we have to include the file in the project in his machine too.
I can't believe this is the normal behavior for TFS (I think this is basic) so I assume we are doing something wrong... Any idea of what's happening??
Thanks in advance ;-)
Have you also checked in the project file to which the added files are related? In Solution Explorer these files will only be available if they are also in the local project file. Also check if the user attempting to download has the project file checked out already.
Update:
From within Solution Explorer you'll only get what's required for the referenced files in the .proj file. For Source Control Explorer yes it should get those files if you've never downloaded them before. Best way to be sure is rather than just do Get Latest (which tries to sync what it understands server side about your local workspace with the server) do a Get Specific Version -> Latest Version. This way you can "force" download of all project files irrespective of existing workspace status.
The hint above did not help in my scenario.
What did do the trick was to check out an old version (with the two overwrite-checkboxes) and get the latest version afterwards (also with the two overwrite-checkboxes).
This is a huge bug in TFS IMO.
I just had the same problem. My co-worker created a new file (with content, not just an empty file). He did a check-in, and everything went well on his end. But the file never got downloaded to my project. I could go into Source control explorer and navigate to the file in question, then do a "get latest version" or "get specific version" on it, but it still didn't appear in my project.
Then my co-worker did some cosmetic changes to the file and did another commit. This time, when I did a simple "get latest version" on the whole project, the file downloaded without a problem.
Check the most voted answer in this thread. This should be the nearest to what you are looking for
Find unadded files in Team Foundation Server

Force old revision to the current revision

I made a boo boo with a with a Visual Studio 2010 project on TFS2010, and instead of spending hours trying to fix it did i decide just to go 2 revisions back, and continue from there, which worked fine.
But how can i now make my local version the current revision? When i try to commit i just get a version mismatch error.
Open the pending changes conflicts dialog:
Top Menu -> View -> Other Windows -> Pending Changes
If you want to make your local version the current version. You will be presented with a list of conflicts.
For every conflict select: "Keep Local Version"
Here is an example of what your screen will look like notice the "Keep Local Version" option to the right of the item in question.
Check it in and you should be good to go.
You check everything out with your local copies and during check-in you will encounter conflicts. You will resolve them by overwriting server version and accepting your local copies.
Voila, your local copies are latest now.

Resources