Skip to main content

Get-VSTeamTfvcBranch

SYNOPSIS

Gets a branch for a given path from TFVC source control.

SYNTAX

List (Default)

Get-VSTeamTfvcBranch [-IncludeChildren] [-IncludeParent] [-IncludeDeleted] [-ProjectName] <String>
[<CommonParameters>]

ByPath

Get-VSTeamTfvcBranch -Path <String[]> [-IncludeChildren] [-IncludeParent] [-IncludeDeleted]
[<CommonParameters>]

DESCRIPTION

Get-VSTeamTfvcBranch gets a branch for a given path from TFVC source control.

EXAMPLES

Example 1

Get-VSTeamTfvcBranch -Path $/MyProject/MyBranch

This command returns the branch object for the path $/MyProject/MyBranch

Example 2

Get-VSTeamTfvcBranch -Path $/MyProject/MyBranch -IncludeChildren

This command returns the branch object for the path $/MyProject/MyBranch and its child branches.

Example 3

Get-VSTeamTfvcBranch -Path $/MyProject/MyBranch -IncludeParent

This command returns the branch object for the path $/MyProject/MyBranch and its parent.

Example 4

Get-VSTeamTfvcBranch -Path $/MyProject/MyBranch -IncludeDeleted

This command returns the branch object for the path $/MyProject/MyBranch, even if it's marked as deleted.

Example 5

'$/MyProject/MyBranch','$/AnotherProject/AnotherBranch' | Get-VSTeamTfvcBranch

This command returns the branch objects for the paths $/MyProject/MyBranch and $/AnotherProject/AnotherBranch by using the pipeline.

Example 6

Get-VSTeamTfvcBranch -ProjectName TestProject

This command returns all the branches under a project.

PARAMETERS

-ProjectName

Specifies the team project for which this function operates.

You can tab complete from a list of available projects.

You can use Set-VSTeamDefaultProject to set a default project so you do not have to pass the ProjectName with each call.

Type: String
Parameter Sets: List
Aliases:

Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-Path

Full path to the branch.

Type: String[]
Parameter Sets: ByPath
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-IncludeChildren

Return child branches, if there are any.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-IncludeParent

Return the parent branch, if there is one.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-IncludeDeleted

Return branches marked as deleted.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

NOTES

You can pipe paths to this function.

Prerequisites:

Set the account and version that all calls will use with Set-VSTeamAccount. Default version sets to API version 3.0 (TFS2017) if not manually set.

tips:

  • check called version of the API with Get-VSTeamAPIVersion or Get-VSTeamInfo
  • use Set-VSTeamDefaultProject to set default project for every call
  • use Set-VSTeamDefaultAPITimeout to change the default timeout of 60 seconds for all calls.
  • use Profiles to load an account and the correct version