1

I'm new to git and trying to do what I thought would be trivial. I just want to extract the files from the downloaded archive.

I used git clone https://android.googlesource.com/kernel/common.git

I got a directory "common" with several subdirs including common/.git/objects/pack/*biglongname*.pack and a similarly named .idx file.

I've search all over for a simple command to extract the source files. I've tried git archive, git unpack-objects, git pull and a bunch of others with no joy.

What am I missing here? this just has to be simple.

0

3 Answers 3

1

This repository is a bit strange, since the HEAD has no files in it. You have to checkout one of the two real branches:

 git checkout android-3.0

or

 git checkout android-2.6.39
1
  • this worked perfectly. Thanks mucho. And thanks to other responders too!
    – DontPanic
    Commented Jan 31, 2012 at 20:02
1

If you just want the source, not the repository, just delete the entire .git subdirectory.

If you've cloned the repository and you have nothing but the .git folder, try creating a branch to checkout the code:

git checkout -b master origin/master

do this within the common directory.

I'm surprised that git archive didn't work for you. That is another way of extracting the source to a different place.

3
  • Hmmm. All I got was the .git and subdirectories. If I delete that, nothin's left.
    – DontPanic
    Commented Jan 31, 2012 at 19:13
  • I tried "git achive something > mytar but I couldn't figure out what something should be.
    – DontPanic
    Commented Jan 31, 2012 at 19:18
  • Try checking out the source as I've edited my answer to describe.
    – Abizern
    Commented Jan 31, 2012 at 19:29
1

The development in this particular repository doesn't happen on the master branch (the default branch checked out after the clone). You can use gitk to visualize what happened in any branch, e.g. for the last year

$ gitk --all --since='last year'

There you will see lots of commits to e.g. the android-3.0 branch. To switch your clone to that branch do

$ git checkout android-3.0

Had you known this you could have specified the branch to checkout after the clone at clone time

$ git clone -b android-3.0 https://android.googlesource.com/kernel/common.git

Not the answer you're looking for? Browse other questions tagged or ask your own question.