简体   繁体   中英

Git repository is on the master branch, but has no master ref

I just came across this in one of my git repos due to a failure in a script of mine. I thought that every branch head, including master, had a corresponding ref. That's true in most of my repos, but I have two of them that don't.

git branch says * master and two tracking branches

but .git/refs/heads is empty

So I obviously misunderstand what the heads refs are for. My config has master in it

[branch "master"]
    remote = origin
    merge = refs/heads/master

but that refs/heads/master isn't there.

Any idea what's going on?

For optimization reasons, sometimes git packs the references in .git/packed-refs in the format:

e220b43404aca15574c7a9be3724a40587093414 refs/heads/master

Once you change the value for the reference, it will create back a .git/refs/heads/master file (until the next packing).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM