Git(TortoiseGit) - 如何将单个文件恢复到之前的修订版本,然后撤消恢复? [英] Git (TortoiseGit) - How to revert a single file to a previous revision and then undo the revert?

查看:3095
本文介绍了Git(TortoiseGit) - 如何将单个文件恢复到之前的修订版本,然后撤消恢复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用Git和TortoiseGit时:有人知道如何将单个文件(或完整的存储库)还原到以前的版本吗?

例如,我有一个存储库包含多个文件。一个文件存在三个版本(1; 2; 3)。现在我想从修订版本3改回2.



TortoiseGit在显示日志对话框中提供了回复功能,允许跳回到特定的修订版本,但这将恢复您的整个存储库,而不是一个单一的文件。



同样,一旦我恢复了某些东西,我不知道如何撤消恢复和跳转返回到最新版本。

解决方案

在TortoiseGit中,答案是右键单击项目文件夹并单击Show Log,然后右键点击您要回滚的更改,然后点击切换/签出到此...。它会让你从提交堆栈中的奇怪位置开始,或者在你计划提交并希望事物保持健全的情况下分支。


When using Git with TortoiseGit: Does somebody know how to revert a single file(or a complete repository) to a previous revision?

For example I have a repository containing multiple files. One file exists in three revisions (1 ; 2 ; 3). Now I want to change from revision 3 back to 2.

TortoiseGit offers a "Revert" function in the "Show log" dialog which allows to jump back to a specific revision, but this will revert your whole repository instead of a single file.

Also once I have reverted something, I don't have a clue how to undo the revert and jump back to the newest revision.

解决方案

In TortoiseGit the answer is to right-click the project folder and click Show Log, then right-click the change you want to roll back to and click Switch/Checkout to this... . It will let you then proceed from that weird place in the commit stack, or branch in case you plan to commit and want things to stay sane.

这篇关于Git(TortoiseGit) - 如何将单个文件恢复到之前的修订版本,然后撤消恢复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆