docs(advanced-git): never swap the explicit worktree list for a glob - #146
Merged
Conversation
Signed-off-by: Sebastian Mendel <info@sebastianmendel.de>
|
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The batch-cleanup recipe demonstrates the safe shape — an explicit list of the branches this session created — but never names the unsafe substitution, so replacing it with a directory glob reads as a harmless shortcut.
It is not. A glob cannot tell your worktrees from pre-existing ones, and
worktree remove --forcefollowed bybranch -Dis not undoable from the shell.Observed 2026-08-06: a 19-repo release sweep cleaned up with
*/release-v*and removed a leftoverrelease-v1.12.0worktree and branch belonging to an unrelated release from months earlier. Nothing was lost only because that branch had already been merged and tagged.Also adds two habits that bound the damage when the list is wrong anyway:
worktree listbefore removing, andbranch -dover-Dso an unmerged branch survives.Generated by
/retro.