简体   繁体   English

如何使用tig或命令行签出版本?

[英]How to check out a version with tig or command line?

I have a git repository on my machine, and at the moment it is only for this machine and myself to trace different versions of development. 我的机器上有一个git存储库,目前仅此机器和我本人可以跟踪不同版本的开发。

I have been using basically git console commands, and tig to visualize different commits. 我一直在使用git控制台命令和tig来可视化不同的提交。

I just want to know what is the simplest way to check out a version, to another working folder on my machine... 我只想知道将版本检出到计算机上另一个工作文件夹的最简单方法是什么...

»[…] check out a version, to another working folder« suggests that you are looking for the git clone command: »[…]签出一个版本,到另一个工作文件夹«建议您正在寻找git clone命令:

git clone /path/to/your/repo /new/repo
cd /new/repo
git checkout <branch/tag/sha1>

You can use git checkout-index if you want to export only the files. 如果只想导出文件,则可以使用git checkout-index

  1. If your working directory is "dirty", stash away your changes with git stash 如果您的工作目录是“ dirty”,请使用git stash您的更改

  2. Checkout the version you want with git checkout <version> 使用git checkout <version>签出您想要的git checkout <version>

  3. Export to desired directory with git checkout-index -a -f --prefix=/destination/path/ 使用git checkout-index -a -f --prefix=/destination/path/导出到所需目录

  4. Go back to where you were with git checkout HEAD@{1} 返回到使用git checkout HEAD@{1}

  5. Pop your changes back off with git stash pop git stash pop更改

If your working directory is clean you can omit steps 1 and 5. 如果您的工作目录是干净的,则可以省略步骤1和5。

Here is SO answer with some more details. 这是一些更多细节的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM