แก้ไข

แชร์ผ่าน


Resolve command (Team Foundation Version Control)

Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019

Visual Studio 2019 | Visual Studio 2022

The Team Foundation Version Control (TFVC) tf resolve command lets you resolve conflicts between changed items in your workspace and the latest or destination versions of items on the server.

Prerequisites

To use the resolve command, you must be either the workspace owner or have the global Administer workspaces permission set to Allow. You must also have the Read and Check out permissions for the items involved in a resolve operation set to Allow. For more information, see Default TFVC permissions.

Syntax

tf resolve [itemspec] 
[/auto:(AutoMerge|TakeTheirs|KeepYours|OverwriteLocal|DeleteConflict|KeepYoursRenameTheirs)] 
[/preview] [(/overridetype:overridetype | /converttotype:converttype] [/recursive] [/newname:path] [/noprompt] [/login:username, [password]]

Parameters

Arguments

Argument

Description

<itemspec>

Used to identify the file or folder for which to resolve version conflicts. If omitted, all items with conflicts are included. For more information about how TFVC parses the itemspec to determine which items are within scope, see Use Team Foundation version control commands.

Note

You can specify more than one itemspec argument.

<overridetype>

Used with the /overridetype option. Specifies the encoding type of the files involved, for example binary.

<converttype>

Used with the /converttotype option. Specifies the encoding type, such as unicode.

<path>

Used with the /newname option. Specifies the new path of the affected file or folder.

<username>

Provides a value to the /login option. You can specify a user name value as either DOMAIN\username or username.

Options

Option

Description

/auto

Resolves outstanding conflicts between different versions of specified items in the current workspace by using one of the following options.

If differences can't be reconciled automatically, either because the file is binary or because the workspace and server versions contain overlapping content changes, the conflict remains unresolved pending the selection of one of the manual merge options.

  • AutoMerge: Automatically reconciles non-overlapping content differences between the specified workspace version of an item and the latest server version.

  • TakeTheirs instructs TFVC to overwrite workspace revisions with the server revision. For conflicts generated by running the merge command, this option accepts the changes from the source of the merge and overwrites the changes in the target.

  • KeepYours instructs TFVC to keep your changes and discard the changes in the server version of an item. For conflicts generated by running the merge command, this option discards the changes from the source of the merge and leaves the target unchanged.

  • OverwriteLocal overwrites the file in your workspace with the server version. You can use this option to resolve conflicts that arise from a writable file in your workspace.

  • DeleteConflict removes a conflict from the conflict table and the option/description table.

  • KeepYoursRenameTheirs accepts the contents and name of your file and renames their file to a new name that you specify. This option requires a single-item filespec, and you must also include the /newname option.

/preview

Displays current conflicts but does nothing with them.

/overridetype

Specifies optional encoding for files involved in a three-way merge. The files are treated as the specified encoding. You must determine the correct encoding. TFVC saves the resulting merge output in the specified encoding in your workspace. For more information about file encodings, see Manage file types.

Note

You can't specify both an /overridetype and a /converttotype.

/converttotype

Specifies the encoding used for temporary conversion for the input in a three-way merge operation. The merge output is saved in the specified encoding in your workspace. This option is an advanced option and seldom used. For more information about file encodings, see Manage file types.

Note

You can't specify both an /overridetype and a /converttotype.

/recursive

Resolves items in the specific directory and subdirectories.

/newname

Resolves a name collision conflict. Can only be used in conjunction with AutoMerge and KeepYoursRenameTheirs. With AutoMerge, /newname is only valid with conflicts that involve rename and/or undelete. If used, you must supply a new path.

/login

Specifies the user name and password to authenticate the user with Azure DevOps.

/noprompt

Suppresses any prompts for input.

Remarks

You can use the resolve command to select a resolution for pending changes that conflict with the server version.

If version conflicts are detected between your version and the version on the destination server during a get, check-in, or merge operation, a prompt appears for you to select a conflict resolution by using the resolve command. You must resolve conflicts before you can check in your pending changes.

For more information on how to use the tf command-line utility, see Use Team Foundation version control commands.

Examples

The following example opens the Resolve Conflicts dialog box in Visual Studio so you can tell TFVC how to deal with pending changes that conflict with the server version.

tf resolve

The following example attempts to resolve all conflicts by automatically merging the changes.

tf resolve /auto:automerge