Closed amtoine closed 9 months ago
when using gm repo branches --clean when checked out on a dangling branch, the command will halt because git branch -D fails.
gm repo branches --clean
git branch -D
tk run --clean { # setup the repo let repo = $nu.temp-path | path join foo if ($repo | path exists) { rm -f -r $repo } git init $repo cd $repo git checkout --orphan main git commit --allow-empty --no-gpg-sign --message "init" # create two branches and checkout the first one git branch bar git branch foo git checkout bar print $"dangling branches: (gm repo branches | where ($it.remotes | is-empty) | get branch)" gm repo branches --clean }
Initialized empty Git repository in /tmp/foo/.git/ Switched to a new branch 'main' [main (root-commit) e35547d] init Switched to branch 'bar' dangling branches: [bar, foo, main] 2023-12-06T16:33:36.290|INF|deleting branch `bar` error: Cannot delete branch 'bar' checked out at '/tmp/foo'
i expected gm repo branches --clean to skip branch bar and remove foo without an error.
bar
foo
No response
Describe the bug
when using
gm repo branches --clean
when checked out on a dangling branch, the command will halt becausegit branch -D
fails.How to reproduce
Expected behavior
i expected
gm repo branches --clean
to skip branchbar
and removefoo
without an error.Configuration
Additional context
No response