在 Git 中签出早期标签以用于只读目的的最简洁方法
我的本地计算机上有一个工作树,还有一个远程存储库。假设我想在已知标签上快速构建项目的早期版本,而不影响工作版本的当前状态。我的倾向是签出一个单独的树,这似乎像这个问题一样:
从远程存储库进行克隆,然后在其中签出。但克隆做了很多工作并拉下了所有修订状态。有没有一种轻量级的方式来表达“在这个提交/标签处获取世界的当前状态并将其喷射到这个目录中?” (不需要进一步的修订控制——就 Git 而言,它是“只读”的。)
也许不需要——只是检查。
谢谢。
I have a working tree on my local machine, and a remote repository as well. Let's say I want to quickly build an earlier version of my project at a known tag without disturbing the current state of the working version. My inclination is to checkout a separate tree, which seems to go like in this question:
Download a specific tag with Git
With a clone from the remote repository followed by a checkout in there. But the clone does a lot of work and pulls down all the revision state. Is there any lightweight way of saying "grab me the current state of the world at this commit/tag and spray it into this directory?" (Further revision control not necessary-- it's "read only" as far as Git should be concerned.)
Maybe not-- just checking.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果都是本地的,你可以这样做:
假设你根本不关心另一棵树有任何 git 信息。如果您愿意,可以使用 git-new-workdir 脚本,它基本上创建一个克隆,除了用返回原始的符号链接填充
.git
目录repo,这样就不需要额外的磁盘空间。这是一种很好的方法 - 不需要额外的磁盘空间,并且您可以使用一个存储库进行开发,一个用于测试等。If it's all local, you can do this:
That's assuming you don't care about the other tree having any git information at all. If you want it to, you could use the git-new-workdir script, which basically creates a clone, except populating the
.git
directory with symlinks back to the original repo, so that it takes no extra disk space. It's a nice approach - no extra disk space, and you can use one repo for development, one for testing, etc.尝试
Try
听起来你正在寻找 git-export:做一个“ git 导出”(如“svn 导出”)?
Sounds like you're looking for git-export: Do a "git export" (like "svn export")?