Skip to content

Commit

Permalink
Suggest local branches in git merge
Browse files Browse the repository at this point in the history
Resolves: #33
  • Loading branch information
AnderssonPeter committed Jan 30, 2022
1 parent 487845f commit 946c731
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions PowerType/Dictionaries/git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ $allBranches = [DynamicSource]@{
}
}

$localBranches = [DynamicSource]@{
Name = "LocalBranches";
Description = "Local branches";
CommandExpression = {
git --no-optional-locks branch --no-color | % { $_.trim(' *$(') } | % { $_.StartsWith("remotes/origin/") ? $_.Substring(15) : $_ } | Where-Object { !$_.StartsWith("HEAD") } | Select -Unique
};
Cache = [Cache]@{
ByCurrentWorkingDirectory = $true;
ByTime = New-TimeSpan -Seconds 10
}
}

$stashes = [DynamicSource]@{
Name = "Stashes";
Description = "Stashes";
Expand Down Expand Up @@ -789,6 +801,10 @@ $stashes = [DynamicSource]@{
Name = "merge";
Description = "Join two or more development histories together";
Parameters = @(
[ValueParameter]@{
Name = "local-branch";
Source = $localBranches
},
[FlagParameter]@{
Keys = @("--commit");
Name = "commit";
Expand Down
2 changes: 1 addition & 1 deletion PowerType/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"PowerShell": {
"commandName": "Executable",
"executablePath": "pwsh.exe",
"commandLineArgs": "-NoExit -command \"$DebugPreference = 'Continue'\nImport-Module $(TargetDir)$(TargetFileName)\nEnable-PowerType -PassThru\""
"commandLineArgs": "-NoExit -NoProfile -command \"$DebugPreference = 'Continue'\nImport-Module $(TargetDir)$(TargetFileName)\nEnable-PowerType\nSet-PSReadLineOption -PredictionViewStyle ListView\""
}
}
}

0 comments on commit 946c731

Please sign in to comment.