Skip to content

Commit

Permalink
♻ refactor(Invoke-GitCheckout): Simplify the way to search branch by …
Browse files Browse the repository at this point in the history
…matching operators
  • Loading branch information
capdiem committed Jun 28, 2023
1 parent 26f59d6 commit 1774f86
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion PSGitUtils/PSGitUtils.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSGitUtils.psm1'

# Version number of this module.
ModuleVersion = '1.15.0'
ModuleVersion = '1.15.1'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down
18 changes: 9 additions & 9 deletions PSGitUtils/PSGitUtils.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -329,18 +329,18 @@ function Invoke-GitCheckout {
git checkout $branch
}
}
# Invoke-GitCheckout -s key
elseif ($args.Count -eq 2 -and $args[0] -eq "-s") {
[string]$pattern = $args[1]
$branch = Get-OptionsForChoosingLocalOrOriginBranch "Switch branch" "Please choose a branch to switch" $pattern
else {
$res = git checkout $args
if($res -eq $null) {
Write-Host "Unable to switch to branch $($args[0]), trying to search by matching operators..." -ForegroundColor Blue

if ($branch) {
git checkout $branch
$branch = Get-OptionsForChoosingLocalOrOriginBranch "Switch branch" "Please choose a branch to switch" $args[0]

if ($branch) {
git checkout $branch
}
}
}
else {
git checkout $args
}
}

## list origin branches
Expand Down

0 comments on commit 1774f86

Please sign in to comment.