I often use git add worktree wtname to create separate branches. When I merge the changes on the branch wtname to the master, I expect that git branch --no-merged should not list wtname branch. However, it does. Worse, even after removing the worktree:
rm -rf wtname
git worktree remove wtname
I can't delete this branch unless I force delete it. After the above written commands, if I run git branch -d wtname, it throws the following error:
error: The branch 'wtname' is not fully merged.
If you are sure you want to delete it, run 'git branch -D wtname'.
Why is this the case?
That tops my suspect list. When you let
git worktree adddefault-create a branch, it doesn't track anything. When yougit branch -da branch, if it doesn't track anything, its safety check is against your current checkout.