Update switch-branch.ps1

This commit is contained in:
Markus Fleschutz 2022-11-23 14:57:39 +01:00
parent 0ced649ed1
commit 4f8c263552

View File

@ -6,7 +6,7 @@
.PARAMETER BranchName .PARAMETER BranchName
Specifies the branch name Specifies the branch name
.PARAMETER RepoDir .PARAMETER RepoDir
Specifies the path to the Git repository Specifies the path to the local Git repository
.EXAMPLE .EXAMPLE
PS> ./switch-branch main C:\MyRepo PS> ./switch-branch main C:\MyRepo
.LINK .LINK
@ -19,7 +19,7 @@ param([string]$BranchName = "", [string]$RepoDir = "$PWD")
try { try {
if ($BranchName -eq "") { $BranchName = read-host "Enter name of branch to switch to" } if ($BranchName -eq "") { $BranchName = read-host "Enter name of branch to switch to" }
if ($RepoDir -eq "") { $RepoDir = read-host "Enter path to the Git repository" } if ($RepoDir -eq "") { $RepoDir = read-host "Enter path to the local Git repository" }
$StopWatch = [system.diagnostics.stopwatch]::startNew() $StopWatch = [system.diagnostics.stopwatch]::startNew()
@ -29,7 +29,7 @@ try {
$RepoDir = Resolve-Path "$RepoDir" $RepoDir = Resolve-Path "$RepoDir"
$RepoDirName = (Get-Item "$RepoDir").Name $RepoDirName = (Get-Item "$RepoDir").Name
"⏳ (2/6) Checking folder 📂$RepoDirName..." "⏳ (2/6) Checking Git repository 📂$RepoDirName..."
if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" } if (-not(Test-Path "$RepoDir" -pathType container)) { throw "Can't access directory: $RepoDir" }
$Result = (git status) $Result = (git status)