简体   繁体   中英

Undo git commit with TortoiseGit

I'm using TortoiseGit in Windows for my git projects.

I made a local commit on my project. And I want to undo it.

How to undo git commit with TortoiseGit? without discarding my changes

Undo last commit: Reset

在此输入图像描述

and

在此输入图像描述

[NOTE] if you want to keep working tree changes, use Mixed instead.

the result:

在此输入图像描述


Undo/Remove the commit which is not the last one: Rebase with Force

在此输入图像描述

and

在此输入图像描述

(You may hit the conflicts, but how to resolve the conflicts is another story. :P )

and

在此输入图像描述

the result:

在此输入图像描述

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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