What's this in the yellow round box?


I've tried git branch -D, git tag -d but none succeeded. So how to delete it?


3 Answers 3


Alexey Ten has the better answer for this because it handles branches, tags, and packed refs. Future visitors should try that solution before this one.

If it's a tag, the following command ought to work:

git tag -d refs/original/refs/heads/master

But, since you've said it doesn't, you can just delete the file out of the .git directory. From the repository root, a command like this will get it:

rm .git/refs/tags/refs/original/refs/heads/master

The path may be slightly different if the git-tag command failed, so you may want to cd .git/refs and find the offending head by trial-and-error. Deleting the file will remove the reference from your local repository.

  • 2
    It's not a tag, however, I've found it as .git/refs/original/refs/heads/master.
    – Lenik
    May 14, 2011 at 6:45
  • 5
    Use git update-ref rather than manually mutating Git's internals. See Alexey's answer.
    – wchargin
    Oct 27, 2018 at 1:00

This command should work

git update-ref -d refs/original/refs/heads/master
  • 1
    This worked for me with the same problem. Note that the reference was stored in a file called .git/packed-refs. If you open that up you can see the line with the SHA and the string "refs/original/refs/heads/master". You could probably delete that line, but I'd use this command to be safe.
    – Matt N
    Aug 10, 2012 at 13:07
  • 16
    +1: You should always use git update-ref -d instead of just rming the ref - bad things can happen otherwise. Sep 6, 2012 at 23:00
  • 3
    This should be the accepted answer Sep 3, 2015 at 22:29
  • 1
    @CallumRogers why? Dec 7, 2015 at 21:19
  • 6
    @wahnfrieden because git could use packed refs and there will be no corresponding file in refs directory
    – Alexey Ten
    Feb 4, 2016 at 8:15

This is a ref. Normally created by git filter-branch - it is a pointer to where your branch was before you ran git filter-branch.

And to delete any ref, you can always push nothing to it in the local repository:

git push . :refs/original/refs/heads/master

The other answers also covered pretty well other ways of deleting.

  • 2
    "Pushing nothing" to delete the reference locally is very clever. Aug 3, 2013 at 13:48
  • Made my day. I had a reference to a remote tag that the remote no longer existed. This is the only command that worked.
    – C4F
    Oct 4, 2018 at 18:19
  • I was bashing my head against "error: dst refspec main matches more than one" because I had a ref/head/main and a ref/heads/main due to a typo. Your answer saved my head.
    – Josh Dean
    May 5 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.