Lessons · Git · the branch it tracked is gone
The branch it tracked is gone
'gone' means the remote branch your local branch tracks no longer exists. Your branch and its commits are untouched; what is missing is the thing it was compared against.
Hone is a place to practise programming. This is one of its lessons, written out in full and free to read without an account.
What it is for
It usually means the pull request was merged and the branch tidied up, and it usually means nothing is wrong.
How to think about it
fetch --prune is what makes git notice. Then check whether the commits are actually merged before deleting anything.
Worked example
git branch -vvIt still thinks origin/feature is there, because nothing has looked.
git fetch -q --prune originNow it looks, and removes what is no longer on the remote.
git branch -vvorigin/feature: gone.
git log --onelineAnd your commit is exactly where it was.
git branch --merged mainThe question worth asking before deleting: is the work actually in main?
Your turn
Fetch, and drop remote-tracking branches that no longer exist.
git fetch origin
Try it in a real repository
The trap
Reading 'gone' as 'merged'. It can also mean somebody closed the pull request and tidied up, and the work is only on your machine.