a_secenthusiast
a_secenthusiast

Reputation: 319

what after git-unpack-objects to get the actual file?

I did a git-unpack-objects on a .pack file. What I got was a lot of subdirectories from 00 to ff , each containing a lot of tiles with names as SHA1 hashes , but trying to display their contents gets me some junk. Now I need to get the actual source files from those hash files?

Upvotes: 0

Views: 6133

Answers (1)

FauxFaux
FauxFaux

Reputation: 2515

If you place the .pack files inside the .git/objects/pack/ directory of a newly git init'd repository, you should be able to git checkout -b somebranch ANYSHA1.

For example:

# find a commit:
faux@reg:~/git% git rev-parse HEAD
6f5e880c68099b185e60b2492c75e506e16d8292
faux@reg:~/git% cd ..

# init:
faux@reg:~% git init bar
Initialized empty Git repository in /home/faux/bar/.git/

# add packs:
faux@reg:~% cp git/.git/objects/pack/* bar/.git/objects/pack
faux@reg:~% cd bar

# checkout:
faux@reg:~/bar% git checkout -b somebranch 6f5e880c68099b185e60b2492c75e506e16d8292
Switched to a new branch 'somebranch'

# done!
faux@reg:~/bar% ls
abspath.c
contrib
...

Upvotes: 3

Related Questions