Merge Command
The merge command applies changes from one branch into another.
Note
The results of this command are not reflected in the Team Foundation source control server until you perform a check-in operation. For more information, see How to: Check In Pending Changes.
tf merge [/recursive] [/force] [/candidate] [/discard]
[/version:versionspec] [/lock:none|checkin|checkout] [/preview]
[/baseless] [/nosummary] source destination
Parameters
Argument | Description |
---|---|
versionspec |
Provides a value such as C2 for the /version option. For more information about how Team Foundation parses a version specification to determine which items are within its scope, see Command-Line Syntax. |
source |
Specifies the file or folder to act as the source of the merge. |
destination |
Specifies the file or folder to act as the destination of the merge. |
Option | Description |
---|---|
/recursive |
Matches the source item specification in the current directory and any subfolders. |
/force |
Ignores the merge history and merges the specified changes from the source into the destination, even if some or all these changes have been merged before. |
/candidate |
Prints a list of all changesets in the source that have not yet been merged into the destination. The list should include the changeset ID that has not been merged and other basic information about that changeset. |
/discard |
Does not perform the merge operation, but updates the merge history to track that the merge occurred. |
/version |
For a selective merge, this option specifies the range that should be merged into the destination. For a catch-up merge, this parameter specifies the version before which all un-merged changes should be merged. For a selective merge, the version range denotes the beginning and end points of the set of changes to be merged. For example, if you attempt to merge version 4~6, the changesets 4, 5, and 6 are merged. |
/lock |
Specifies a lock type or removes a lock from an item. For more information, see Understanding Lock Types. Lock Options:
|
/preview |
Shows a preview of the merge. |
/baseless |
Performs a merge without a basis version. That is, allows the user to merge files and folders that do not have a merge relationship. After a baseless merge, a merge relationship exists and future merges do not have to be baseless. |
/nosummary |
Omits summary of errors and warnings when doing this requires more than 10 lines of output. |
/noprompt |
Suppresses any prompts for input from you. |
Remarks
You can use the merge command of the tf command-line utility to apply changes in an existing source branch to an existing target branch. You can merge an individual revision or a complete changeset to the target branch. You can merge changes from the source to the target branch or from the destination to the source branch.
The merge command also lets you query for changes in a source branch which have not been migrated to the target branch. Additionally, it lets you indicate that certain changes will never be merged from the source to the destination and should no longer be displayed as candidates for a merge operation.
Examples
The following example merges changes from HelloWorld_beta1 that have not been merged into HelloWorld_RTM.
c:\projects>tf merge HelloWorld_beta1 HelloWorld_RTM /recursive
The following example merges changeset 137 into branch2.
c:\projects>tf merge /version:C137~C137 branch1 branch2 /recursive
The following example prints a list of the changesets in branch1 that have not been merged into branch2.
c:\projects>tf merge /candidate branch1 branch2 /recursive
The following example prints a list of changesets in branch2 that have not been merged back into branch1.
c:\projects>tf merge /candidate branch2 branch1 /recursive
The following example discards changeset 137 as a candidate for merging into branch2.
c:\projects>tf merge /discard /version:C137~C137 branch1 branch2 /recursive
Security
To use the merge command, you must have the Check out permission set to Allow for the workspace folder that contains the destination and you must have the Read permission set to Allow for the workspace folder that contains the source. For more information, see Team Foundation Server Permissions.
See Also
Tasks
Walkthrough: Advanced Functionality of Source Control
How to: Resolve Conflicts
Reference
Command-Line Syntax
Branch Command
Merges Command
Concepts
Source Control Security Rights and Permissions
Understanding Branching