Skip to content

Update‑RemoteTrackingBranch

viscalyxbot edited this page Sep 30, 2025 · 1 revision

SYNOPSIS

Updates the remote tracking branch in the local git repository.

SYNTAX

Update-RemoteTrackingBranch [-RemoteName] <String> [[-BranchName] <String>] [-Force]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Update-RemoteTrackingBranch command fetches updates from the specified remote and branch in Git. It is used to keep the local tracking branch up to date with the remote branch.

EXAMPLES

EXAMPLE 1

Update-RemoteTrackingBranch -RemoteName 'origin' -BranchName 'main'

Fetches updates from the 'origin' remote repository for the 'main' branch.

EXAMPLE 2

Update-RemoteTrackingBranch -RemoteName 'upstream'

Fetches updates from the 'upstream' remote repository for all branches.

EXAMPLE 3

Update-RemoteTrackingBranch -RemoteName 'origin' -BranchName 'main' -Force

Fetches updates from the 'origin' remote repository for the 'main' branch with the Force parameter, bypassing confirmation prompts when used with -Confirm:$false.

PARAMETERS

-BranchName

Specifies the name of the branch to update. If not provided, all branches will be updated.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Force

Forces the operation to proceed without confirmation prompts when similar to -Confirm:$false.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-RemoteName

Specifies the name of the remote.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
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

None

This function does not accept pipeline input.

OUTPUTS

None

This function does not return any output.

NOTES

This function requires Git to be installed and accessible from the command line.

RELATED LINKS

Clone this wiki locally