如何使用 TortoiseGit 恢复特定提交?

How to revert a particular commit using TortoiseGit?

我有一个名为 messaging parent 的存储库。 最初这个 repo 的版本是 1.1.0 。然后它升级到 1.2.0 并做了一些更改。现在,我们在此版本之上推出了更多更改。出于某种原因,必须还原版本从 1.1.0 更改为 1.2.0 并进行一些更改的提交。是否有可能恢复该提交但仍保留我们在其之上推送的最新更改?两次提交中都没有冲突的文件

是的,您可以:TortoiseGit -> Show Log,然后 select 此提交,按右键并从上下文菜单中 select:Revert Change by this commit.

将创建新的提交,这将还原此提交,所有其他提交保持不变。

来自 atlassian git revert:

The git revert command undoes a committed snapshot. But, instead of removing the commit from the project history, it figures out how to undo the changes introduced by the commit and appends a new commit with the resulting content. This prevents Git from losing history, which is important for the integrity of your revision history and for reliable collaboration.