We currently have up to 3 developers working in the same branch.
In Jan, I submitted changesets (say 100-110) that have since had some code overwritten by changsets (111-300) during merges from other team members. I'm now just getting back to my project and I dread having to manually re-type all that code.
I can identify the exact changesets I need.
Is it possible to "merge" these specific changesets into the latest version of the same branch?
You can merge the changes in the same branch.
GO TO Branching and Merging option and click on the merging option you can merge the changes by choosing change set, date or label.
Hope you get my words
Related
Maybe its a confusing title but the scenario is this one - we have two branches; DEV -> QA. When tests are done people merge their changesets from DEV into QA one by one. All fine. The strange thing is that a small number of merged changesets are appearing in Merge wizard when we attempt to do reverse integration QA -> DEV. If I pick one for the merge, pending change shows that files are checked out with an 'merge,edit' tag but when compared to latest there are no differences.
Obviously we need to fix this since the list keeps getting longer and longer. But, I would like to understand why is this happening in the first place. Then, how to fix this situation.
We're using TFS 2015 server and Visual Studio 2015. No 3rd party tools.
Thank you for reading.
When you want to merge back, the changeset reappears is because when TFS does a merge, it bases the merge on prior merge history, not on the actual contents of the source and target files.
If you have such request, you can use tf merge /discard command to update the merge history, which does not perform the merge operation. This discards a changeset from being used for a particular merge.
https://learn.microsoft.com/en-us/azure/devops/repos/tfvc/merge-command?view=azure-devops
Let's say I write some code for a ticket, and check it in for code review (changeset A). The review comes back illustrating some changes that need to be made. I make the required changes, and check it in (creating changeset B). Assuming changeset B renders changeset A obsolete, when it comes time to merge (perhaps from trunk to a deployment branch), should both changesets be merged into it, so that the history is kept, or only the final, correct changeset?
I was under the impression that a correct merge would contain all changes made to a file so that the history could be kept, and there are no dangling changesets in trunk. However, I'm getting some resistance on this in my team. Thoughts?
You should mostly be merging "latest" rather than picking and choosing changesets. If you merge latest then TFVC handles all of the details of merging multiple changesets. You can also choose to merge only up to a specific changeset rather than latest.
http://nakedalm.com/avoid-pick-n-mix-branching-anti-pattern/
As your delevlopers are choosing changesets to merge they are actively reducing the quality of the final product. You are in essence maximising the number of potential integration issues...
I made a branch and the first time I went to merge from the source to the branch there were a whole bunch of old changesets coming up that it says were not merged but they were present well before the branch and I confirm that they were there.
Example:
Say I branched from Source to Target when there were 9 changesets in Source.
Change 10 was made in Source.
I go to merge from Source to Target and TFS tells me change 6 and 7 and 10 need to be merged (even though 6 and 7 were there before I branched and I can confirm those changes are in the Target)
I am new to TFS and this happened when I first started to implement Branching and Merging.
The newest branch I made did not do this.
Right now we have a Trunk and then 1 Branch for the ongoing QA for the next release and another Branch for the Hotfixes to Production. It was the QA branch that had this issue but when I made the hotfix branch it was fine.
I have come across this a few times. I eventually just merged the "rogue" candidate change-sets from source to target. I examined the pending merge and determined that there were no changes. Committing the merge got rid of these candidate change-sets. I figured that I could roll back if it didn't work out.
EDIT: It appears that if you upgraded to TFS 2010, there is a bug that will cause extra merge candidates (see http://support.microsoft.com/kb/2135068)
"Any items on a branch that have been renamed multiple times or have had multiple other items occupy their namespace (through add/delete combinations) will have lost their relationships with the corresponding items on other branches."
As for a resolution, the support article says:
"To resolve the issue with extra merge candidates, the /discard option should be used. To do this, run a merge of the following format from a command line:
tf merge <source branch> <target branch> /r /discard:CXXX~CYYY
In this example, XXX and YYY represent the changeset IDs of the range of changes to discard. After this merge has been checked in, the unwanted candidates will no longer appear for future merges. Also be aware that, because of improvements in the merge algorithm in TFS 2010, items deleted in both the source and target branches will result in changes to be merged. In those cases, it is best not to discard the changesets so that the merge history is updated correctly. "
I've had this a few times too. I suspect the cause is some funnyness in the way TFS manages pending merges. If you try to merge these changes, and the Change type is just "merge" and not "merge, edit", then it is safe to merge them and be confident that no changes have occurred. If you don't merge them, TFS will keep trying to merge the non-changes indefinitely, possibly obscuring real changes eventually. I advise merging these non-changes ASAP.
When I do Track Changeset in tfs 2010, then in branch visualisation, I only get to see that selected changeset. However in examples all over the web, I have seen multiple changesets being shown in the hierarchy and Timeline views. Any idea?
What I have got is a main branch and from that I created a dev branch. Then i perform two changsets on dev branch. Now when i do View History on dev branch and select any one of the changeset and perform Track Changeset, then it only shows me that changeset, which is a bit odd because in the timeline view i should be able to see multiple changesets in a time range. Any idea?
Nabeel
nabeelfarid,
You likely have figured this out by now but this may be of use to others. The activity you are performing is called "Track Changeset" and thus by it's default nature and its name it is tracking a single changeset. It does also seem intuitive to me that in a timeline view I could see changesets that were merge candidates versus a single tracked changeset but that is not how it functions. It is only showing the tracking of a single changeset.
There are instances where instead of seeing a single changeset in the branches the tracked changeset has been merged into that instead you will see multiple changesets show up in one or more branches and usually with an * by them. This happens when the changeset that is being tracked has some of the files in the changeset merged into a target in one merge and checkin operation and some or all of the remaining files of the changeset merged into the target under a second (or more) merge and check-in operation.
Take a quick look at this blog post from John Bowen. He has a nice example that shows a a tracked changeset merged into a parent target branch as multiple changesets made up each of a subset of the files in the tracked changeset. He also shows how that might then look if they were forward integrated from that parent into a different child also by way of multiple changesets.
Visualizing Changes Across TFS Branches
If your changesets on dev have not been merged back to your main branch then there is nothing to track. Only as a consequence of merge operation will your dev changes gain a relationship with another changeset (which in your case will be a changeset committed to the main branch).
That is the purpose of the changeset tracking, to help you visualize the propogation of your change across branches. This is useful if you need to verify whether a specific branch has received your changes made on another branch.
(One thing to be aware of is when selecting Track Changeset, in the subsequent Select Branches dialog select all the branches you want to see in the visualization. It may be the case that just the branch associated with your starting changeset is selected and again you will not see the associated changesets on other branches).
If a file has been changed by 10 different changesets, with different users for various changesets.
Then the user that checked in changeset 5, decides to merge his changes.
What will then happen to the changes in changeset 1 to 4? Will they automatically be merged?
TFS has two ways of merging (you can select either one in the TFS Merge dialog):
All changes up to a specific version
Selected change sets
In the second case, you can cherry-pick any change you want, without necessarily merging all other change sets.
Yes, TFS will merge all changes UP TO and INCLUDING changeset 5 automatically.
When you merge a particular changeset back to Main, you are effectively asking TFS to integrate all changes beginning from the previous baseline up to the changeset that you specify.