git - 如何使用 TortoiseGit 还原特定提交?

标签 git github git-branch git-merge tortoisegit

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

最佳答案

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

enter image description here

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

来自 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.

关于git - 如何使用 TortoiseGit 还原特定提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46690334/

相关文章:

git push 到 gitlab ssh 失败

hadoop - Caused by : java. lang.ClassCastException : org. apache.hadoop.io.LongWritable cannot be cast to org.apache.hadoop.io.Text

git - 关于 git 发布管理和困惑的建议

git - 列出所有不带星号的本地 git 分支

git - 当我在终端中创建一个新分支时,为什么图形不显示从 master 分支分支出来的新分支?

git - 当 pull 请求关闭并删除远程 @{push} 分支时清理本地分支

Git merge repo 之外的文件内容(--no-index)

git 提交修改而不丢失标签

git - Capistrano + Git - "unable to find"[提交 SHA]

github - 使用 Worklight 和 GitHub 进行团队开发