Skip to content

git branch -d doesn't seem to delete branch/worktree from git cache #5

Open
@lu0

Description

@lu0

Describe the bug
Title

To Reproduce
Steps to reproduce the behavior:

  1. Run git branch -d old_branch or git branch -D old_branch from git root or from the worktree directory.
  2. This doesn't seem to delete the branch and worktree from the git cache, doing git checkout old_branch re-creates the worktree directory with the files of the 'deleted' branch.

Expected behavior
git checkout old_branch should raise an error after such branch has been deleted.

Screenshots
N/A

Desktop (please complete the following information):

  • OS: Linux Mint 20, but tested on Windows 10 and Windows 11, too.
  • Git version: 2.25.1
  • Shell: Bash 5.0.16
  • Repository version: v1.1.0

Additional context
git branch -d/-D old_branch does indeed delete the worktree directory, but it's kept in the cache.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions