Reputation: 16267
I have just cloned a git repo that already have a bunch of remote branches. I have poked around in the .git folder but I cannot find them, when I do a git show-ref
I get:
cf8e5e98c27ee83a1ff2122f2c2a214e8e06383d refs/heads/master
cf8e5e98c27ee83a1ff2122f2c2a214e8e06383d refs/remotes/origin/HEAD
76541f13b20bb25056788f092f58547d4657bed8 refs/remotes/origin/example
cf8e5e98c27ee83a1ff2122f2c2a214e8e06383d refs/remotes/origin/master
cf8e5e98c27ee83a1ff2122f2c2a214e8e06383d refs/remotes/origin/smpl-remote
e34b3b7e54174c5b862ae16d29a3079c060c160e refs/remotes/origin/test
But the folder: .git\refs\remotes\origin
only contains the HEAD
file
If open the repo in eclipse I can see them:
What am I missing here?
I just tried to remove the internet connection (wifi and wired) but I can still list the remote branches, where in the .git folder is that information??
Upvotes: 2
Views: 63
Reputation: 487755
Andrew C answered in a comment, but I'll add a bit more.
The "missing" branches are "packed". This saves space (and sometimes saves time although mostly that's a wash).
In fact, all branches get packed at various times (when git pack-refs
runs, usually on behalf of git gc
). That's one of several reasons you are supposed to use various front-end and back-end commands (git branch
, git for-each-ref
, git update-ref
, git symbolic-ref
) to work with branches, rather than just peeking into .git/refs/
directly.
It's sometimes convenient to add .git/packed-refs
to your peeking, but remember that this part is an implementation detail and may change.
Upvotes: 4