-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathunfork.ps1
More file actions
33 lines (25 loc) · 726 Bytes
/
Copy pathunfork.ps1
File metadata and controls
33 lines (25 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Branch
)
$ErrorActionPreference = "Stop"
$repoRoot = $PSScriptRoot
$worktreePath = Join-Path (Split-Path $repoRoot -Parent) "tm-$Branch"
if (-not (Test-Path $worktreePath)) {
Write-Error "Worktree not found at $worktreePath"
exit 1
}
Write-Host "This will remove:"
Write-Host " - Worktree: $worktreePath"
Write-Host " - Branch: $Branch"
Write-Host ""
$confirmation = Read-Host "Are you sure? (y/N)"
if ($confirmation -ne 'y' -and $confirmation -ne 'Y') {
Write-Host "Aborted."
exit 0
}
Write-Host "Removing worktree..."
git worktree remove --force $worktreePath
Write-Host "Deleting branch..."
git branch -D $Branch
Write-Host "Done!"