0

I am compiling source from a local git mirror in a separate directory, ie I don't do any work in the Git directory, I just need the source code from it.

Of course I go into the Git directory, check out the ref I want and copy it into the compilation directory, but I want to know if there is a git command for doing it directly

Something along the lines of:

git checkout file://home/user/repo.get treeish  /my/working/directory
Zoe
  • 27,060
  • 21
  • 118
  • 148
vfclists
  • 19,193
  • 21
  • 73
  • 92

2 Answers2

1

I don't know a command which can extract a tree from the repository, but the git archive command can create a tarball (or other format) of the tree at a given commit:

git archive --format=tar <commit-id> > project.tar
davidriod
  • 937
  • 5
  • 14
0

If you want the LAST commit, a git clone --depth 1 could do the trick also...

Philippe
  • 28,207
  • 6
  • 54
  • 78