DEV Community

Michel Sánchez Montells
Michel Sánchez Montells

Posted on • Edited on

Git. Broken reference.

From author of the stories:

  • Where to find out old success solutions I found in the past.
  • How to help my memory.

:-)

Now I will present what works great for me fixing this not common but very annoying issue with git.

When I type

git fetch origin

I got this message:

error: cannot lock ref 'refs/remotes/origin/name-of-the-branch': unable to resolve reference 'refs/remotes/origin/name-of-the-branch': reference broken

After few googleling and stackoverflow I found this.
answer from Raja Anbazhagan

rm .git/refs/remotes/origin/name-of-the-branch
git fsck
Enter fullscreen mode Exit fullscreen mode

The second line is optional. It will only check and something a little bit scary.

;-)

Top comments (0)