I created a branch in TFS off of the main branch. Then in this new branch I made a few changes and added a few files. I checked in my changes. Afterwards, I merged this branch back to the main branch.
Then I opened the main branch in Visual Studio and did a get latest version. I expected to see the changes I made in the branch. But they are not there. If I look at the main branch in Source Control Explorer, I see the files that I added.
How do I get my merged changes to show up?
Turns out that when I did the check in, the files that were new got checked in. But the files that were changed didn't (and I somehow lost their changes). These new files made it back to the main branch. So I went back into my branch, and made the changes to the files again. Then I checked them in. Next I merged again. This time everything worked and my changes were in the main branch.
Related
Working in VS 2019. I forgot to check in the original source into TFS before making changes. So now, I need to get the original source into TFS and the changes in. What are the steps?
Source code in TFS. Latest changes in TFS as history.
If you hadn't checked your local code in TFS.
You could simply manually restore your changed code to original source (also remember to back up changes) and then check in your files.
Finally add your changes to local, check in pending changes. Now everything get back on track.
If you already checked your code in TFS.
You could delete all files in local workspace and add your source code, now Visual Studio will auto detect the pending changes, you just need to check in changes.
At present, the latest changeset is your original source. You could not change the order of generated changeset. However, you could choose to Roll back changesets.
A changeset is a permanent part of the history of your
version-controlled items and cannot be undone or removed. However, you
can roll back the effects of one or more changesets.
Then your local should be original source + changes, keep working and moving forward.
MS Team Foundation Server 2015, with the native TFS SCM:
On the main branch, every user can see pending changes from every other user.
I branched off a branch from the main branch with several check-ins in the past already. I'm currently having locally modified files on that branch and see them as pending changes in Source Control Explorer. However another colleague does not see these pending changes. Why?
(He can see pending changes on the main trunk just fine like everyone else.)
Is it a property of the branch that i need to set somewhere?
You need to check whether you have mapped the Main and Branch in the same workspace. And check whether you are using server workspace.
Here's our situation:
In TFS 2010 we have the main dev branch and a release branch.
At some point, it was decided that some code was in a poorly named directory so it was renamed in TFS (only on the main branch as it wasn't a bug fiw).
I have now fixed a bug in this moved code on the dev branch and want to merge the fix into the release branch.
However, when I do this, rather than performing a merge on the file, it creates a copy of the file in the new location and labels the change as 'merge, branch'.
Am I doing something wrong or is this a 'feature' of TFS?
Update: I've just revisited this post and retried. steps to reproduce the error are:
I have a file (control.cs) in Main/Desktop/UserControls and
Releases/V5/Desktop/UserControls.
Using source control explorer I 'Move' UserControls to UserControls2 and check in (I've also tried 'Rename' btw with the
same results)
I Edit control.cs on Main and check in.
I merge Main into Releases/V5 (Note I am merging on the whole branch, not just UserControls)
I now see the modified control.cs in Releases/V5/Desktop/UserControls2 and the old one in Releases/V5/Desktop/UserControls
I answered it earlier with the assumption that you have the DEV branch and I have more inputs after I did some more research in TFS with what you explained above.
This is what I did, I have a Source branch call it Main, I branched from Main called Release. In Main, I have two folders (f1 and F2), I renamed folder F2 to F3 and checked in the changes. Then edited the file File1 within F2 (now F3) and made some changes to the content, checked in the changes.
Now I merged the Main to Release and every changes were merged properly. In Release, the folder F2 was renamed to F3 and the file1 was merged to the right folder as well.
The change should show up as merge, rename for the folder and edit for the file.
Everything worked like a charm. I am using TFS2010 as well. Can you please let me know if you have done anything differently than what I just explained above? Am i missing something?
UPDATE:
I tested the exact scenario that you mentioned above and it merges the control.cs file properly even after the Move/Rename in the source branch. I believe that in your case - in the Release branch someone recreated (deleted and added again) the Usercontrols folder and/or the Usercontrol.cs file, so TFS doesnt recognize that its the same file/folder from the source branch and hence its not getting merged properly.
Can you check the history of the Usercontrol file in the release branch to confirm that?
Just adding some screenshots from my test:
I have a main branch and a dev branch in TFS. I merged changes from the main branch up into the dev branch fine. Now when I try merging up again it says there is nothing to merge.
However when I merge down from the dev branch to the main branch, it magically decides that a bunch of files have differences (which are only present in the main branch). Why does it decide this? Because TFS is comparing using the wrong changelist version from the dev branch! It is using the second to last changelist, not the latest one like I asked!
Sure I could resolve this by doing a force merge, but then every file in main would be marked as changed when it actually hasn't. What I want is for TFS to actually WORK in a logical way, does anybody know a work-around for this behaviour?
Even though this question has been asked a long time ago.
First things first, you are working on a dev branch and you have a main branch like the published one, so when you merge up to main you should get all changesets you checked in on dev branch.
If that is not the case, make sure you have nothing in pending changes to make sure you checked your changes in.
I work with a workspace for each branch not sure if you do this, make sure that you are on the workspace of the main branch and right click on dev branch and do the merge accordingly.
Hope this is what you were asking for.
Yesterday I worked on a set of changes I don't want to check in yet, and at the end of the day, decided to shelve my changes. The changes included a bunch of added files. The shelving worked fine, but today when I unshelved, the following happened:
VS told me four writable files already exist in my workspace. These files were the ones I added
I told VS it's all good, overwrite them and we're set
VS finished the unshelve...
... but left the "pending changes" tab empty.
I figured maybe something went wrong and re-tried the unshelve. At this point VS proceeded to tell me I've got pending changes in my workspace. So now I can't check in, can't unshelve and apparently the files are locked for edit under my name (yes, we use the lock-modify-unlock mode, unfortunately). What gives, and how do I fix it?
Edit: Upon further inspection, Source Control Explorer doesn't show pending changes from me, so apparently it's just my workspace that's borked. Correction: yes, it does, I was just looking at the wrong branch, aargh!
Edit 2: tf.exe does show the changes. I tried to undo them, delete the files that were still in the workspace (the ones that caused first VS error) and unshelved without errors. For a short while VS displayed the pending changes, but when the operation completed, they all disappeared.
OK, I'm just full of stupid today. The shelveset I was working with didn't belong to the branch I had open. Opening the project from the correct branch miraculously shows the changes in the pending changes tab!