File size: 497 Bytes
9439512
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
$ErrorActionPreference = 'Stop'
$files = git ls-files
foreach ($f in $files) {
    if ($f -notlike 'backend/*' -and $f -ne 'backend') {
        git rm -q --ignore-unmatch -- "$f"
    }
}
Write-Output "-- staged removals --"
git status --porcelain=2 --branch
$staged = git diff --staged --name-only
if (-not $staged) {
    git commit --allow-empty -m 'Deploy: keep only backend (empty commit if no removals)'
} else {
    git commit -m 'Deploy: keep only backend'
}
Write-Output "-- commit done --"