Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the remote branches are not shown in the ".git\refs\remotes\origin\" folder?

Tags:

git

In my test github repo, all my remote branches are shown in the .git\refs\remotes\origin\ folder. Like this:

enter image description here

But I just checked another non-toy repo, all the remote branches cannot be seen in that folder. Like this:

enter image description here

But the git remote show origin does show a lot of remote branches. And I still can create new local branch to track those remote branches.

Why?

like image 972
smwikipedia Avatar asked Oct 16 '25 20:10

smwikipedia


1 Answers

Git has a feature where it will pack the seperate ref files into a single file to improve performance and lower the storage cost. When a ref is packed, it will no longer exist as a seperate file in the refs folder.

When a ref is missing from the traditional $GIT_DIR/refs directory hierarchy, it is looked up in this file and used if found.

You can pack the ref files using the git pack-refs command.

like image 178
Wazner Avatar answered Oct 19 '25 14:10

Wazner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!