When I type 'git branch -a', it shows red previously deleted branches. Is this normal?

0

Issue

I have cloned a remote GitHub repository to my computer, and it all went well. I worked on some branches, and wanted to see all of them, so I typed:

git branch -a

And it showed this:

* master
  remotes/origin/cleanup
  remotes/origin/master
  remotes/origin/test

I have previously created the ‘cleanup’ and ‘test’ branches, merged them, deleted them on the local side, and the remote side, and yet they are showing in this weird ‘file-directory like’ fashion. Is this normal?

Sorry if this is a bad question. I am new to Git and Github.

Solution

You need to fetch with --prune so that deleted remote branches disappear on the local repo (no messing with local branches, even if one local branch was created from one of those deleted remote branches).

git fetch --prune -a

Answered By – eftshift0

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More