简体   繁体   English

使用TortoiseGit撤消git提交

[英]Undo git commit with TortoiseGit

I'm using TortoiseGit in Windows for my git projects. 我在Windows中使用TortoiseGit作为我的git项目。

I made a local commit on my project. 我在我的项目上做了一个本地提交。 And I want to undo it. 我想撤消它。

How to undo git commit with TortoiseGit? 如何用TortoiseGit撤消git commit? without discarding my changes 不丢弃我的更改

Undo last commit: Reset 撤消上次提交: Reset

在此输入图像描述

and

在此输入图像描述

[NOTE] if you want to keep working tree changes, use Mixed instead. [注意]如果要继续更改树,请使用“ Mixed

the result: 结果:

在此输入图像描述


Undo/Remove the commit which is not the last one: Rebase with Force 撤消/删除不是最后一个的提交: Rebase with Force

在此输入图像描述

and

在此输入图像描述

(You may hit the conflicts, but how to resolve the conflicts is another story. :P ) (你可能会遇到冲突,但如何解决冲突是另一回事。:P)

and

在此输入图像描述

the result: 结果:

在此输入图像描述

TortoiseGit -> Show Log -> Revert change by this commit

这将生成一个恢复提交的提交,因此您不会“丢失”您的更改。

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

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