Skip to content

Start‑GitRebase

viscalyxbot edited this page Sep 30, 2025 · 1 revision

SYNOPSIS

Starts a Git rebase operation from a remote branch.

SYNTAX

Start-GitRebase [[-RemoteName] <String>] [[-Branch] <String>] [[-Path] <String>] [-Force]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

The Start-GitRebase command initiates a rebase operation from a remote branch onto the current branch. It uses the Invoke-Git command to execute the git rebase operation.

EXAMPLES

EXAMPLE 1

Start-GitRebase

Starts a rebase from the 'origin/main' branch onto the current branch.

EXAMPLE 2

Start-GitRebase -RemoteName 'upstream' -Branch 'develop'

Starts a rebase from the 'upstream/develop' branch onto the current branch.

EXAMPLE 3

Start-GitRebase -Path 'C:\repos\MyProject'

Starts a rebase from 'origin/main' onto the current branch in the 'C:\repos\MyProject' repository.

PARAMETERS

-Branch

Specifies the name of the branch to rebase from. If not specified, defaults to 'main'.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: Main
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

-Path

Specifies the path to the git repository directory. If not specified, uses the current directory.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: (Get-Location).Path
Accept pipeline input: False
Accept wildcard characters: False

-RemoteName

Specifies the name of the remote repository. If not specified, defaults to 'origin'.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: Origin
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