Better....

Better Edit-DokcerCompose (suppress errors when permissions don't allow)
Better aliases (eds and edc)
Better Git commands.
This commit is contained in:
lksz 2021-09-10 01:20:12 -04:00
parent 86fdee1acc
commit 33b4c5166b
7 changed files with 59 additions and 7 deletions

View file

@ -3,10 +3,11 @@
[string]$LocalPath,
[Parameter(Mandatory)]
[string]$GitOrigin,
[string]$Branch='HEAD'
[string]$Branch='HEAD',
[switch]$sudo
)
$local:gitPath = Join-Path 'themes' 'plextheme' | Get-Path
function doGit { git "--git-dir=`"$(Join-Path $LocalPath '.git')`"" "--work-tree=`"$LocalPath`"" $args }
function doGit { & $(if($sudo){"sudo"}) git "--git-dir=`"$(Join-Path $LocalPath '.git')`"" "--work-tree=`"$LocalPath`"" $args }
$local:savedErrorActionPreference = $ErrorActionPreference
$ErrorActionPreference = 'Stop'
$local:exists = Test-Path $LocalPath

View file

@ -1,7 +1,15 @@
$local:workTree = git worktree list --porcelain | Select-String worktree | ForEach-Object { $_ -split 'worktree ' } | Where-Object { $_ }
[CmdletBinding(SupportsShouldProcess)]param(
[switch]$sudo
)
$local:workTree = git worktree list --porcelain |
Select-String worktree |
ForEach-Object { $_ -split 'worktree ' } |
Where-Object { $_ }
$local:sudoCmd = [string]::Empty
if( $sudo ) { $sudoCmd = "env sudo" }
Push-Location $workTree
$null = git reset HEAD
$null = git rm --cached -r .
$null = git add .
$null = Invoke-Expression "& $sudoCmd git reset HEAD 2>&1"
$null = Invoke-Expression "& $sudoCmd git rm --cached -r . 2>&1"
$null = Invoke-Expression "& $sudoCmd git add . 2>&1"
git status
Pop-Location