Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get rid of "refs/bisect/bad" branches in Git

Tags:

git

git-bisect

I have the following in my ~/.gitconfig (this is only here to help you understand what I'm looking at):

[alias]
    lg = log --graph --all --pretty=format:'%Cred%h %Cgreen(%cr)%Creset - %s %C(yellow)%d %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative

When I do a git log, it shows me the full commit tree with branch names and stuff. Yesterday I initiated a git bisect and today I see there is a refs/bisect/bad branch in the output of my log.

What exactly is the refs/bisect/bad branch and how do I get rid of it?

like image 707
Kostas Avatar asked Mar 11 '11 10:03

Kostas


1 Answers

When you're using git bisect, it uses refs/bisect/bad to track the last bad commit. (That ref is updated when you do git bisect bad.)

I suspect that what's happened here is that you got to the end of the bisect, and it reported the first bad commit, but you never ended the bisection with git bisect reset, which would clean up the refs that it created. You can still run that command, and it'll take you back to where you were before starting the bisections - however, I'd make sure that your work is committed and git status is clean before doing so, just to avoid any possible confusion.

If you use __git_ps1 in your bash prompt, it will helpfully note that you're still in a bisection by outputting (9dad0bb...)|BISECTING. I discussed __git_ps1 a bit in another answer, which might be helpful.

like image 117
Mark Longair Avatar answered Nov 14 '22 15:11

Mark Longair