是否有一个内置的 Git 命令用于检查 Git 引用或分支到非 git 目录?
It there a built in Git command for checking out a Git ref or branch into a non git directory?
我正在从一个单独目录中的本地 git 镜像编译源代码,即我不在 Git 目录中做任何工作,我只需要它的源代码。
当然是进入Git目录,查看我想要的ref复制到编译目录下,但是我想知道有没有git命令可以做到直接
大致如下:
git checkout file://home/user/repo.get treeish /my/working/directory
我不知道可以从存储库中提取树的命令,
但是 git archive 命令可以在给定的提交中创建树的 tarball(或其他格式):
git archive --format=tar <commit-id> > project.tar
如果您想要最后一次提交,git clone --depth 1
也可以解决问题...
我正在从一个单独目录中的本地 git 镜像编译源代码,即我不在 Git 目录中做任何工作,我只需要它的源代码。
当然是进入Git目录,查看我想要的ref复制到编译目录下,但是我想知道有没有git命令可以做到直接
大致如下:
git checkout file://home/user/repo.get treeish /my/working/directory
我不知道可以从存储库中提取树的命令, 但是 git archive 命令可以在给定的提交中创建树的 tarball(或其他格式):
git archive --format=tar <commit-id> > project.tar
如果您想要最后一次提交,git clone --depth 1
也可以解决问题...