zheyuanWang
zheyuanWang

Reputation: 1374

why does git checkout remember deleted branches

git checkout ( then press Tab twice), shows a list of branches including already deleted ones.

Most of them are not exist in the list from git branch -a. They can not be removed by git branch -D trash_branch

How could I clean up the list remembered by git chechout?

Upvotes: 2

Views: 263

Answers (1)

Jocce Nilsson
Jocce Nilsson

Reputation: 1748

Your issue is that the remote status it not reflected on the local git clone. You can prune the remotely deleted branches with:

git fetch -p

Then continue by deleting the local ones as you already described.

git branch -D <branch name>

To see the current status of branches compared to the remote, use this useful command: (thanks Erik Schierboom)

git for-each-ref --format '%(refname:short) %(upstream:track)' refs/heads

Upvotes: 4

Related Questions