Dustin Oprea
Dustin Oprea

Reputation: 10236

Nonexistent branch in ls-remote output

I have a branch that appears in my "git ls-remote" output, but it's not mentioned anywhere under .git/refs, .git/logs, not in the config, only has a brief mention under .git/logs/HEAD and doesn't otherwise appear in plaintext anywhere else under .git/, and is not listed as a branch in Github (the remote).

It's mystifying. Where else could this branch be recorded?

I tried recreating the branch, pushing, and then pruning from both sides, but it didn't seem to affect it. This is the ls-remote output, for reference. It's the bottom entry.

e00b6910a899a378c876b9af9238e0f048db30d8    HEAD
95bd66fe02d3fc532c479e364b118b1623f956ba    refs/heads/dustin/debug_chromium
8a4031f8d9493f2cbdeef8c3674a65b8803360f7    refs/heads/dustin/pricing_and_availability_pp
e00b6910a899a378c876b9af9238e0f048db30d8    refs/heads/master
c71f62939e69205b4b052a5094397c0bf8c270dc    refs/remotes/origin/dustin/redis_based_classifier

Upvotes: 1

Views: 104

Answers (1)

LeGEC
LeGEC

Reputation: 51790

As @ElpieKay said in its comment : this ref is not under refs/heads or refs/tags, so it won't be stored in your local repo (in your configuration, check the refspecs listed as fetch = ... values under your [remote "origin"] section).

It is probably an artefact of some previous repo, or some previous push command where someone specified origin/dustin/redis_based_classifier as the ref to push.


If you want to get a local branch pointing to that commit : you can specify an explicit refspec with git fetch :

# this will store it in a local branch named 'dustin/redis_based_classifier' :
git fetch origin refs/remotes/origin/dustin/redis_based_classifier:refs/heads/dustin/redis_based_classifier

If you want to delete that ref from the remote, you use git push -d and specify its full name :

git push origin -d refs/remotes/origin/dustin/redis_based_classifier

Upvotes: 1

Related Questions