pyinfra
pyinfra copied to clipboard
pyinfra/operations: `git worktree add --force` support
-- Why is this needed?
Current scenario:
-
During pyinfra deployment:
git worktree add /path/to/wk commitish -
rm -f /path/to/wkhappens -
Deployment is run again, however
git worktree add /path/to/wk commitishfails:fatal: '../wk' is a missing but already registered worktree; use 'add -f' to override, or 'prune' or 'remove' to clearRequiring manual intervention:
git worktree pruneand evengit branch -d wkif the branch was created.
Solution:
Use -f/--force (i.e. force) to avoid the failure entirely.