Part of #52. Depends on the shared git-invocation helper sub-issue.
Goal
Add a command to switch/checkout a branch (ObjectiveGit's Set-Branch), with
-CreateNew, -Force, and -Track behavior — modernized.
Modernize (do not port as-is)
- ObjectiveGit assembles a command string and runs it via
Invoke-Expression
("git -C $Repository checkout$ExtendedCLI $Branch"). Use the shared helper
with a git argument array instead.
- Add
[CmdletBinding(SupportsShouldProcess)] and honor -WhatIf/-Confirm
(this changes working-tree state, and -Force can discard local changes).
- Consider aligning with
git switch / git switch -c semantics rather than
raw checkout where it reads more clearly; keep the flag surface intuitive.
- Cross-platform repository path handling.
- Drop the magic exit-code / "Bug with ObjectiveGit" branch (handled by the
helper).
Acceptance criteria
- Exported from both the
.psm1 and .psd1 export lists.
- Comment-based help;
SupportsShouldProcess honored.
- Final command name uses an approved verb and fits the existing module surface
(name open to discussion).
- README command table +
[Unreleased] CHANGELOG updated.
- Deterministic Pester tests.
build/Test-Modules.ps1 and build/Invoke-Tests.ps1 pass.
Part of #52. Depends on the shared git-invocation helper sub-issue.
Goal
Add a command to switch/checkout a branch (ObjectiveGit's
Set-Branch), with-CreateNew,-Force, and-Trackbehavior — modernized.Modernize (do not port as-is)
Invoke-Expression(
"git -C $Repository checkout$ExtendedCLI $Branch"). Use the shared helperwith a git argument array instead.
[CmdletBinding(SupportsShouldProcess)]and honor-WhatIf/-Confirm(this changes working-tree state, and
-Forcecan discard local changes).git switch/git switch -csemantics rather thanraw
checkoutwhere it reads more clearly; keep the flag surface intuitive.helper).
Acceptance criteria
.psm1and.psd1export lists.SupportsShouldProcesshonored.(name open to discussion).
[Unreleased]CHANGELOG updated.build/Test-Modules.ps1andbuild/Invoke-Tests.ps1pass.