How do I find changesets between two TFS branches? - tfs

Is it possible to get a list of all changesets that are different between two different TFS branches? I'm not talking about file differences.
I have a main code base (MAIN). I create a new branch from that called (MAIN-BRANCH). I create another branch called (RELEASE). I check-in five times to MAIN-BRANCH, then merge to MAIN.
I want to pull all the changeset comments that have occurred between RELEASE and MAIN.

can you use the TF merges command to do this for you:
tf merges branchroot1 branchroot2 /recursive
See the Merge command for more help.

In TFS 2005 this isn't possible, comments and changeset details are not passed from branch to branch. You have to look in the branch the changesets occurred in and compare the dates to find the ones you want.

Related

TFS Create branches from Main - selected changeset

I have an issue; we have a Main branch, and we have few changesets (that belong to 3 different features).
I created three DEV branches By Date (and selected a date that is prior any of the changesets).
I cherry picked the changesets from Main, and merged them to appropriate DEV branches.
I RolledBack all these changesets from Main so that, the main becomes clean.
Now I want to merge one of DEV branch to Main and deploy for testing,
The problem is; it doesn't pick all the changesets, and even for the ones that it picks, it doesn't pick all the modified files.
How can I merge from DEV to Main? Please help.
Thanks
When TFS does a merge, it bases the merge on prior merge history, not on the actual contents of the source and target files.
You could try the /force option with the tf merge command. The /force flag ignores merge history that indicates a particular changeset was previously merged from source to target (perhaps incorrectly), and merges the changeset again. You can do a /force merge for a single changeset or for a range of changesets. For just changeset #123456 the command would be:
tf merge /force $/Source/File.cs;C123456~123456 $/Target/file.cs
Check the following blog for more details:
https://blogs.msdn.microsoft.com/billheys/2011/03/16/my-source-and-target-files-are-different-but-merge-tells-me-there-are-no-changes-to-merge/

Ignoring 2 changesets

I'm using TFS 2010. I have 2 changesets in child branch that I do not want to merge in the parent branch.
e.g
(1002) Rolled back changeset
(1001) Changeset checked in by mistake
I don't want these changesets from appearing in the merge menu when you attempt to merge into the parent branch.
If I have understood correctly that I can use the following TFS command to ignore these 2 particular changesets or will the rollback changeset interfere?
tf merge childbranch parentbranch /r /version:1001~1002 /discard
You can do a discard
merge.
This has to be done from the command line. Open up the Developer
command
prompt,
then navigate to a folder under either of your branches (i.e. navigate
to one of the affected
workspaces).
Then type:
tf merge /r /discard "$/Project/B1" "$/Project/B2" /v:C12345~C12345
This will take the changeset identified (in this case it was changeset
#12345), and update it as merged to the target branch (branch B2). The target files will be checked out, but they will not be changed - you
can simply check them in to complete the operation. After that the
changeset will no longer appear as a merge candidate. You can specify
a range of changesets to merge at the same time, but they should be
contiguous.
Note that after doing this a changeset will occasionally still show up
as a merge candidate - this is rather uncommon with the latest
versions of TFS, and it is virtually impossible to fix (unless you are
running your own local install of TFS and want to get your hands very
dirty in the database). If you end up with one of these marooned
changesets, just ignore it.
Source:
Finding merge candidates in TFS
Note: When the command has finished, you still need to check in the merge.
For more tutorials, you could also refer below blogs:
TFS: Discard changesets when merging to branches
DISCARDING CHANGESETS IN TFS

TFS 2010: Remove changesets to be merged

In TFS 2010, when I want to merge files from one branch to another, I get a list of changesets that are yet to be merged to the target branch. The problem is a lot of these changesets have already been manually merged. So I am getting a lot of 'There were no changes to merge.' messages.
So I need to remove those changesets ( which have already been merged, i.e. no changes to merge) from the total list of changesets that are to be merged with the target branch. Please suggest a way to do this as I am new to TFS.
You should always be meeting the latest, or everything up to a specific changeset.
http://nakedalm.com/avoid-pick-n-mix-branching-anti-pattern/
Picking and choosing changesets to merge is not a good way to manage your code.
To unblock your merge you will need to discard the merger candidates that are no longer relevant.
tf merge /discard

Is there a way to associate a new TFS changeset with an old changeset?

So I fixed a bug on our main branch some months back, let's say some old changeset 555. Recently, I manually copied these changes to a child branch for a recently approved hotfix, changeset 999. I would like to do a Track Changeset on 999 and see this it has been merged to main as 555. But, I've done this backwards according to the TFS rules, you can't merge down to a child branch.
Is there a way to tell TFS "accept my old changeset 555 as the merge of 999 to the main branch"?
This is analogous to the ClearCase version tree workflow, using the "don't perform merge, just draw arrow". Thus the Track Changeset for either 555 or 999 would show that they are related.
I'm not sure what you mean by
But, I've done this backwards according to the TFS rules, you can't merge down to a child branch.
There shouldn't be anything preventing you merging this change to a child branch, you might have some merge conflicts to resolve. However if that really isn't a possibility and you want to merge "999" in to the main branch without actually merging the code (i.e. adjust the merge history) then you can using the tf merge command line.
Open a visual studio command prompt and use the command
tf merge $/TeamProject/childBranch $/TeamProject/MainBranch /version:C999~C999 /recursive /discard
This will tell TFS to update its history to say that the merge occured even though it hasn't. You might want to use the /preview switch before you do the merge "for real" to make sure you are discarding the files you expect.

How can I check which branches a TFS 2008 changeset has been merged into?

I have some changesets in a TFS 2008 branch which were not merged back into trunk. Time has passed, and now no-one is entirely sure which changesets have made it into trunk. I understand that TFS 2010 allows you to see graphically which branches a changeset has been merged to, but how can I find this out in TFS 2008?
I think all you can you do is use the TF merge command to determine which changesets have not been merged into another branch - one branch at a time.
tf merge /recursive /format:brief /candidate $/Branch1 $/Branch2 /preview
will show you what changessets from branch1 are candidates to be merged into branch 2. Of course you can put this into a script to run multiple times.

Resources