Reputation: 2481
I have a git repository with lots of branches: git branch
lists more than 20 branches. But ls .git/refs/heads
lists only 4 of them. How can that be?
To investigate the issue a bit, I created a test repository in an empty directory, added one file, commited the change and created a new branch side
. Now git branch
gives me
* master
side
and ls .git/refs/heads
gives
master side
However, after a git gc
, the files in .git/refs/heads
disappear, but git branch
still shows me both branches. Where does git get this information from?
Upvotes: 4
Views: 114
Reputation: 820
Your refs are getting packed for performance reasons they can now be found in .git/packed-refs cat .git/packed-refs
. This man page does a pretty good job of explaining it https://www.kernel.org/pub/software/scm/git/docs/git-pack-refs.html.
Upvotes: 4