-
Notifications
You must be signed in to change notification settings - Fork 1
Receive‑GitBranch
Pulls the latest changes from the upstream branch, optionally checking out a specified branch first.
Receive-GitBranch [-BranchName <String>] [-UpstreamBranchName <String>] [-RemoteName <String>] [-Rebase]
[-Path <String>] [-Force] [-WhatIf] [-Confirm] [<CommonParameters>]
Receive-GitBranch [-BranchName <String>] [-UpstreamBranchName <String>] [-RemoteName <String>] [-Checkout]
[-Rebase] [-Path <String>] [-Force] [-WhatIf] [-Confirm]
[<CommonParameters>]
The Receive-GitBranch command pulls the latest changes from the upstream branch. It can optionally checkout a specified local branch first if the -Checkout switch is used. When the -Rebase switch is used, it fetches the upstream branch and rebases the local branch using the fetched upstream branch instead of merging.
When BranchName and/or RemoteName are specified without -Checkout, the command performs a pull from the specified remote branch without switching the current branch first.
Receive-GitBranch
Pulls the latest changes into the current branch using the default git pull behavior.
Receive-GitBranch -RemoteName 'upstream' -BranchName 'feature-branch'
Pulls changes from the 'feature-branch' on the 'upstream' remote into the current branch without checking out a different branch first.
Receive-GitBranch -Checkout -BranchName 'feature-branch'
Checks out the 'feature-branch' and pulls the latest changes using the default git pull behavior.
Receive-GitBranch -Rebase
Fetches the upstream changes and rebases the current branch using the upstream branch.
Receive-GitBranch -Checkout -BranchName 'feature-branch' -UpstreamBranchName 'develop' -Rebase
Checks out the 'feature-branch', fetches changes from the 'develop' upstream branch, and rebases the local branch using the upstream 'develop' branch.
Receive-GitBranch -RemoteName 'upstream' -UpstreamBranchName 'main' -Rebase
Fetches changes from the 'main' branch on the 'upstream' remote and rebases the current branch using those changes.
Receive-GitBranch -Path 'C:\repos\MyProject' -Checkout -BranchName 'feature-branch'
Sets the working directory to 'C:\repos\MyProject', checks out the 'feature-branch', and pulls the latest changes.
Specifies the name of the branch. When used with -Checkout, this branch will be checked out first. When used without -Checkout, specifies the remote branch to pull from. If not specified, defaults to '.' which is resolved to the current local branch name.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: .
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies that the command should checkout the specified branch before pulling. By default, the command operates on the current branch.
Type: SwitchParameter
Parameter Sets: Checkout
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseForces 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: FalseSpecifies the path to the git repository directory. If not specified, uses the current directory. When specified, runs the git operations in the specified directory.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies that the command should fetch the upstream branch and rebase the local branch using the fetched upstream branch instead of merging.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the name of the remote repository. If not specified, defaults to 'origin'.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Origin
Accept pipeline input: False
Accept wildcard characters: FalseSpecifies the name of the upstream branch to pull from. If not specified, defaults to 'main'. This parameter is used when rebasing to specify the upstream branch for rebase operations.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Main
Accept pipeline input: False
Accept wildcard characters: FalsePrompts 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: FalseShows 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: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This function requires Git to be installed and accessible from the command line.
If you have configured 'git config --global pull.rebase true', the command's default behavior will perform a rebase using git pull even without the -Rebase switch.
- Assert-GitLocalChange
- Assert-GitRemote
- Assert-IPv4Address
- Clear-AnsiSequence
- ConvertTo-AnsiSequence
- ConvertTo-AnsiString
- ConvertTo-DifferenceString
- ConvertTo-RelativePath
- Disable-CursorShortcutCode
- Get-ClassAst
- Get-ClassResourceAst
- Get-GitBranchCommit
- Get-GitLocalBranchName
- Get-GitRemote
- Get-GitRemoteBranch
- Get-GitTag
- Get-LinkLayerAddress
- Get-ModuleByVersion
- Get-ModuleFileSha
- Get-ModuleVersion
- Get-NumericalSequence
- Get-PSReadLineHistory
- Get-TextOffset
- Install-ModulePatch
- Invoke-Git
- Invoke-PesterJob
- New-GitTag
- New-SamplerGitHubReleaseTag
- Out-Difference
- Pop-VMLatestSnapshot
- Push-GitTag
- Receive-GitBranch
- Remove-GitTag
- Remove-History
- Remove-PSHistory
- Remove-PSReadLineHistory
- Rename-GitLocalBranch
- Rename-GitRemote
- Request-GitTag
- Resolve-DnsName
- Resume-GitRebase
- Send-WakeOnLan
- Split-StringAtIndex
- Start-GitRebase
- Stop-GitRebase
- Switch-GitLocalBranch
- Test-FileHash
- Test-GitLocalChanges
- Test-GitRemote
- Test-GitRemoteBranch
- Test-IPv4Address
- Update-GitLocalBranch
- Update-RemoteTrackingBranch