[英]How to roll back previous history of the file git vscode?
How to reload the previous history of the file in git source control in vscode?如何在vscode中重新加载git源代码管理中文件的先前历史记录? vs code provides to restore only last commit and I can see all the history of the file with "Git History" extension in vscode but is there any way to roll back to any history of the file?
vs code 仅提供恢复上次提交的功能,我可以在 vscode 中看到带有“Git History”扩展名的文件的所有历史记录,但是有没有办法回滚到文件的任何历史记录?
There is an awesome extension called GitLens for that:有一个很棒的扩展名为GitLens :
After installed, go to thee source control tab, right click on the file and select, "Open File History".安装后,转到源控制选项卡,右键单击该文件并选择“打开文件历史记录”。 Select your commit, then right click over it and click "Restore" from popup menu.
选择您的提交,然后右键单击它并从弹出菜单中单击“恢复”。
If you want to checkout a previous commit, I recommend to do it using command line:如果你想签出之前的提交,我建议使用命令行来完成:
ctrl + j
to open up a terminal in VSCodectrl + j
在 VSCode 中打开一个终端git log
to see commit history (or you can do that by looking the commit history from repo's page, eg on Github).git log
来查看提交历史(或者你可以通过从 repo 页面查看提交历史来做到这一点,例如在 Github 上)。 the commits are sorted that the upper one is more recentSHA key
of the commit you want to checkout and run git checkout sha_key
.SHA key
并运行git checkout sha_key
。 sha_key
is the key you just copied sha_key
是你刚刚复制的密钥
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.