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 stands with Ukraine
  • 25,310
  • 18
  • 114
  • 149
vfclists
  • 18,203
  • 19
  • 69
  • 89

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
  • 111
  • 1
  • 3
0

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

Philippe
  • 24,487
  • 5
  • 44
  • 70